View | Details | Raw Unified | Return to bug 27720
Collapse All | Expand All

(-)lukemftpd/files/patch-ftpd.c (+53 lines)
Line 0 Link Here
1
--- src/ftpd.c.orig	Wed Apr 25 08:25:43 2001
2
+++ src/ftpd.c	Sat May 26 16:46:35 2001
3
@@ -102,6 +102,8 @@
4
  * FTP server.
5
  */
6
 
7
+#define NO_UTMP
8
+
9
 #define	FTP_NAMES
10
 
11
 #include "lukemftpd.h"
12
@@ -780,9 +782,9 @@
13
 	if (logged_in) {
14
 #ifdef NO_UTMP
15
 		if (dowtmp)
16
-			logwtmp(ttyline, "", "");
17
+			ftpd_logwtmp(ttyline, "", "");
18
 		if (doutmp)
19
-			logout(utmp.ut_line);
20
+			ftpd_logout(utmp.ut_line);
21
 #endif /* NO_UTMP */
22
 	}
23
 			/* reset login state */
24
@@ -912,7 +914,7 @@
25
 			/* open wtmp before chroot */
26
 #ifdef NO_UTMP
27
 	if (dowtmp)
28
-		logwtmp(ttyline, pw->pw_name, remotehost);
29
+		ftpd_logwtmp(ttyline, pw->pw_name, remotehost);
30
 
31
 			/* open utmp before chroot */
32
 	if (doutmp) {
33
@@ -921,7 +923,7 @@
34
 		(void)strncpy(utmp.ut_name, pw->pw_name, sizeof(utmp.ut_name));
35
 		(void)strncpy(utmp.ut_host, remotehost, sizeof(utmp.ut_host));
36
 		(void)strncpy(utmp.ut_line, ttyline, sizeof(utmp.ut_line));
37
-		login(&utmp);
38
+		ftpd_login(&utmp);
39
 	}
40
 #endif /* NO_UTMP */
41
 
42
@@ -2155,9 +2157,9 @@
43
 	if (logged_in) {
44
 #ifdef NO_UTMP
45
 		if (dowtmp)
46
-			logwtmp(ttyline, "", "");
47
+			ftpd_logwtmp(ttyline, "", "");
48
 		if (doutmp)
49
-			logout(utmp.ut_line);
50
+			ftpd_logout(utmp.ut_line);
51
 #endif /* NO_UTMP */
52
 #ifdef KERBEROS
53
 		if (!notickets && krbtkfile_env)
(-)lukemftpd/files/patch-logutmp.c (+20 lines)
Line 0 Link Here
1
--- src/logutmp.c.old	Sat May 26 16:07:13 2001
2
+++ src/logutmp.c	Sat May 26 16:07:39 2001
3
@@ -45,7 +45,7 @@
4
  */
5
 
6
 void
7
-login(const UTMP *ut)
8
+ftpd_login(const UTMP *ut)
9
 {
10
 	UTMP ubuf;
11
 
12
@@ -85,7 +85,7 @@
13
 }
14
 
15
 int
16
-logout(const char *line)
17
+ftpd_logout(const char *line)
18
 {
19
 	UTMP ut;
20
 	int rval;
(-)lukemftpd/files/patch-logwtmp.c (+34 lines)
Line 0 Link Here
1
--- src/logwtmp.c.old	Sat May 26 16:08:11 2001
2
+++ src/logwtmp.c	Sat May 26 16:15:20 2001
3
@@ -46,10 +46,30 @@
4
  * after login, but before logout).
5
  */
6
 void
7
-logwtmp(const char *line, const char *name, const char *host)
8
+ftpd_logwtmp(const char *line, const char *name, const char *host)
9
 {
10
 	struct utmp ut;
11
 	struct stat buf;
12
+
13
+	if (strlen(host) > UT_HOSTSIZE) {
14
+		struct addrinfo hints, *res;
15
+		int error;
16
+		static char hostbuf[BUFSIZ];
17
+
18
+		memset(&hints, 0, sizeof(hints));
19
+		hints.ai_family = PF_UNSPEC;
20
+		error = getaddrinfo(host, NULL, &hints, &res);
21
+		if (error)
22
+			host = "invalid hostname";
23
+		else {
24
+			getnameinfo(res->ai_addr, res->ai_addrlen,
25
+				hostbuf, sizeof(hostbuf), NULL, 0,
26
+				NI_NUMERICHOST);
27
+			host = hostbuf;
28
+			if (strlen(host) > UT_HOSTSIZE)
29
+				host[UT_HOSTSIZE] = '\0';
30
+		}
31
+	}
32
 
33
 	if (fd < 0 && (fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0)
34
 		return;
(-)lukemftpd/files/patch-src-Makefile.in (+12 lines)
Line 0 Link Here
1
--- src/Makefile.in.old	Sat May 26 16:33:44 2001
2
+++ src/Makefile.in	Sat May 26 16:34:32 2001
3
@@ -22,8 +22,7 @@
4
 INSTALL	= @INSTALL@
5
 
6
 PROG	= ftpd
7
-OBJS	= cmds.o conf.o ftpd.o ftpcmd.o popen.o @LSOBJS@
8
-# removed: logutmp.o logwtmp.o
9
+OBJS	= cmds.o conf.o ftpd.o ftpcmd.o popen.o logutmp.o logwtmp.o @LSOBJS@
10
 
11
 all:	${PROG}
12

Return to bug 27720