]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/blob - vsftpd/patches/3-vsftpd-pam_hostname-1.patch
Change file layout of the makefiles.
[people/arne_f/ipfire-3.x.git] / vsftpd / patches / 3-vsftpd-pam_hostname-1.patch
1 diff -up vsftpd-2.2.0/sysdeputil.c.pam_hostname vsftpd-2.2.0/sysdeputil.c
2 --- vsftpd-2.2.0/sysdeputil.c.pam_hostname 2009-08-08 03:51:10.000000000 +0200
3 +++ vsftpd-2.2.0/sysdeputil.c 2009-08-24 12:24:07.220623773 +0200
4 @@ -16,6 +16,10 @@
5 #include "tunables.h"
6 #include "builddefs.h"
7
8 +/* For gethostbyaddr, inet_addr */
9 +#include <netdb.h>
10 +#include <arpa/inet.h>
11 +
12 /* For Linux, this adds nothing :-) */
13 #include "port/porting_junk.h"
14
15 @@ -325,6 +329,10 @@ vsf_sysdep_check_auth(struct mystr* p_us
16 const struct mystr* p_remote_host)
17 {
18 int retval;
19 +#ifdef PAM_RHOST
20 + struct sockaddr_in sin;
21 + struct hostent *host;
22 +#endif
23 pam_item_t item;
24 const char* pam_user_name = 0;
25 struct pam_conv the_conv =
26 @@ -345,7 +353,12 @@ vsf_sysdep_check_auth(struct mystr* p_us
27 return 0;
28 }
29 #ifdef PAM_RHOST
30 - retval = pam_set_item(s_pamh, PAM_RHOST, str_getbuf(p_remote_host));
31 + sin.sin_addr.s_addr = inet_addr(str_getbuf(p_remote_host));
32 + host = gethostbyaddr((char*)&sin.sin_addr.s_addr,sizeof(struct in_addr),AF_INET);
33 + if (host != (struct hostent*)0)
34 + retval = pam_set_item(s_pamh, PAM_RHOST, host->h_name);
35 + else
36 + retval = pam_set_item(s_pamh, PAM_RHOST, str_getbuf(p_remote_host));
37 if (retval != PAM_SUCCESS)
38 {
39 (void) pam_end(s_pamh, retval);
40 @@ -558,7 +571,7 @@ vsf_sysdep_has_capabilities(void)
41 }
42 return s_runtime_has_caps;
43 }
44 -
45 +
46 #ifndef VSF_SYSDEP_HAVE_LIBCAP
47 static int
48 do_checkcap(void)
49 @@ -1080,7 +1093,7 @@ vsf_sysutil_recv_fd(const int sock_fd)
50 msg.msg_flags = 0;
51 /* In case something goes wrong, set the fd to -1 before the syscall */
52 p_fd = (int*)CMSG_DATA(CMSG_FIRSTHDR(&msg));
53 - *p_fd = -1;
54 + *p_fd = -1;
55 retval = recvmsg(sock_fd, &msg, 0);
56 if (retval != 1)
57 {
58