|
|
ac8676 |
diff -up vsftpd-2.2.0/sysdeputil.c.pam_hostname vsftpd-2.2.0/sysdeputil.c
|
|
|
ac8676 |
--- vsftpd-2.2.0/sysdeputil.c.pam_hostname 2009-08-08 03:51:10.000000000 +0200
|
|
|
ac8676 |
+++ vsftpd-2.2.0/sysdeputil.c 2009-08-24 12:24:07.220623773 +0200
|
|
|
ac8676 |
@@ -16,6 +16,10 @@
|
|
|
ac8676 |
#include "tunables.h"
|
|
|
ac8676 |
#include "builddefs.h"
|
|
|
ac8676 |
|
|
|
ac8676 |
+/* For gethostbyaddr, inet_addr */
|
|
|
ac8676 |
+#include <netdb.h>
|
|
|
ac8676 |
+#include <arpa/inet.h>
|
|
|
ac8676 |
+
|
|
|
ac8676 |
/* For Linux, this adds nothing :-) */
|
|
|
ac8676 |
#include "port/porting_junk.h"
|
|
|
ac8676 |
|
|
|
ac8676 |
@@ -325,6 +329,10 @@ vsf_sysdep_check_auth(struct mystr* p_us
|
|
|
ac8676 |
const struct mystr* p_remote_host)
|
|
|
ac8676 |
{
|
|
|
ac8676 |
int retval = -1;
|
|
|
ac8676 |
+#ifdef PAM_RHOST
|
|
|
ac8676 |
+ struct sockaddr_in sin;
|
|
|
ac8676 |
+ struct hostent *host;
|
|
|
ac8676 |
+#endif
|
|
|
ac8676 |
pam_item_t item;
|
|
|
ac8676 |
const char* pam_user_name = 0;
|
|
|
ac8676 |
struct pam_conv the_conv =
|
|
|
ac8676 |
@@ -345,7 +353,12 @@ vsf_sysdep_check_auth(struct mystr* p_us
|
|
|
ac8676 |
return 0;
|
|
|
ac8676 |
}
|
|
|
ac8676 |
#ifdef PAM_RHOST
|
|
|
ac8676 |
- retval = pam_set_item(s_pamh, PAM_RHOST, str_getbuf(p_remote_host));
|
|
|
ac8676 |
+ sin.sin_addr.s_addr = inet_addr(str_getbuf(p_remote_host));
|
|
|
ac8676 |
+ host = gethostbyaddr((char*)&sin.sin_addr.s_addr,sizeof(struct in_addr),AF_INET);
|
|
|
ac8676 |
+ if (host != (struct hostent*)0)
|
|
|
ac8676 |
+ retval = pam_set_item(s_pamh, PAM_RHOST, host->h_name);
|
|
|
ac8676 |
+ else
|
|
|
ac8676 |
+ retval = pam_set_item(s_pamh, PAM_RHOST, str_getbuf(p_remote_host));
|
|
|
ac8676 |
if (retval != PAM_SUCCESS)
|
|
|
ac8676 |
{
|
|
|
ac8676 |
(void) pam_end(s_pamh, retval);
|
|
|
ac8676 |
@@ -558,7 +571,7 @@ vsf_sysdep_has_capabilities(void)
|
|
|
ac8676 |
}
|
|
|
ac8676 |
return s_runtime_has_caps;
|
|
|
ac8676 |
}
|
|
|
ac8676 |
-
|
|
|
ac8676 |
+
|
|
|
ac8676 |
#ifndef VSF_SYSDEP_HAVE_LIBCAP
|
|
|
ac8676 |
static int
|
|
|
ac8676 |
do_checkcap(void)
|
|
|
ac8676 |
@@ -1080,7 +1093,7 @@ vsf_sysutil_recv_fd(const int sock_fd)
|
|
|
ac8676 |
msg.msg_flags = 0;
|
|
|
ac8676 |
/* In case something goes wrong, set the fd to -1 before the syscall */
|
|
|
ac8676 |
p_fd = (int*)CMSG_DATA(CMSG_FIRSTHDR(&msg));
|
|
|
ac8676 |
- *p_fd = -1;
|
|
|
ac8676 |
+ *p_fd = -1;
|
|
|
ac8676 |
retval = recvmsg(sock_fd, &msg, 0);
|
|
|
ac8676 |
if (retval != 1)
|
|
|
ac8676 |
{
|