vsftpd/vsftpd-2.1.0-pam_hostname.patch
Martin Nagy 3572541ce7 - update to latest upstream release
- cleanup the spec file
- drop patches fixed upstream: vsftpd-1.0.1-missingok.patch
    vsftpd-1.2.1-nonrootconf.patch vsftpd-2.0.1-tcp_wrappers.patch
    vsftpd-2.0.2-signal.patch vsftpd-2.0.3-daemonize_fds.patch
    vsftpd-2.0.5-correct_comments.patch vsftpd-2.0.5-pasv_dot.patch
    vsftpd-2.0.5-write_race.patch vsftpd-2.0.5-fix_unique.patch
    vsftpd-2.0.5-uname_size.patch vsftpd-2.0.5-bind_denied.patch
    vsftpd-2.0.5-pam_end.patch vsftpd-2.0.5-underscore_uname.patch
    vsftpd-2.0.6-listen.patch
- join all configuration patches into one: vsftpd-1.1.3-rh.patch
    vsftpd-1.2.1-conffile.patch vsftpd-2.0.1-dir.patch
    vsftpd-2.0.1-server_args.patch vsftpd-2.0.3-background.patch
    vsftpd-2.0.5-default_ipv6.patch vsftpd-2.0.5-add_ipv6_option.patch
    vsftpd-2.0.5-man.patch
2009-01-16 17:23:12 +00:00

58 lines
1.7 KiB
Diff

diff -up vsftpd-2.1.0/sysdeputil.c.pam_hostname vsftpd-2.1.0/sysdeputil.c
--- vsftpd-2.1.0/sysdeputil.c.pam_hostname 2008-12-17 22:40:56.000000000 +0100
+++ vsftpd-2.1.0/sysdeputil.c 2009-01-15 15:38:14.000000000 +0100
@@ -16,6 +16,10 @@
#include "tunables.h"
#include "builddefs.h"
+/* For gethostbyaddr, inet_addr */
+#include <netdb.h>
+#include <arpa/inet.h>
+
/* For Linux, this adds nothing :-) */
#include "port/porting_junk.h"
@@ -296,6 +300,10 @@ vsf_sysdep_check_auth(const struct mystr
const struct mystr* p_remote_host)
{
int retval;
+#ifdef PAM_RHOST
+ struct sockaddr_in sin;
+ struct hostent *host;
+#endif
struct pam_conv the_conv =
{
&pam_conv_func,
@@ -314,7 +322,12 @@ vsf_sysdep_check_auth(const struct mystr
return 0;
}
#ifdef PAM_RHOST
- retval = pam_set_item(s_pamh, PAM_RHOST, str_getbuf(p_remote_host));
+ sin.sin_addr.s_addr = inet_addr(str_getbuf(p_remote_host));
+ host = gethostbyaddr((char*)&sin.sin_addr.s_addr,sizeof(struct in_addr),AF_INET);
+ if (host != (struct hostent*)0)
+ retval = pam_set_item(s_pamh, PAM_RHOST, host->h_name);
+ else
+ retval = pam_set_item(s_pamh, PAM_RHOST, str_getbuf(p_remote_host));
if (retval != PAM_SUCCESS)
{
(void) pam_end(s_pamh, retval);
@@ -516,7 +529,7 @@ vsf_sysdep_has_capabilities(void)
}
return s_runtime_has_caps;
}
-
+
#ifndef VSF_SYSDEP_HAVE_LIBCAP
static int
do_checkcap(void)
@@ -1038,7 +1051,7 @@ vsf_sysutil_recv_fd(const int sock_fd)
msg.msg_flags = 0;
/* In case something goes wrong, set the fd to -1 before the syscall */
p_fd = (int*)CMSG_DATA(CMSG_FIRSTHDR(&msg));
- *p_fd = -1;
+ *p_fd = -1;
retval = recvmsg(sock_fd, &msg, 0);
if (retval != 1)
{