vsftpd/vsftpd-2.0.3-pam_hostname.patch
Radek Vokál e89e5bdf63 - vsfptd.log as a default log file has to be rotated (#167359)
- vsftpd does dns reverse before passing hosts to pam_access.so (#159745)
2005-09-09 10:15:31 +00:00

38 lines
1.1 KiB
Diff

--- vsftpd-2.0.3/sysdeputil.c.old 2004-09-14 03:18:54.000000000 +0200
+++ vsftpd-2.0.3/sysdeputil.c 2005-09-09 12:09:10.000000000 +0200
@@ -16,6 +17,9 @@
#include "tunables.h"
#include "builddefs.h"
+/* For gethostbyaddr, inet_addr */
+#include <netdb.h>
+
/* For Linux, this adds nothing :-) */
#include "port/porting_junk.h"
@@ -284,6 +288,10 @@
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,
@@ -302,7 +310,12 @@
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, 0);