diff options
author | dannyboy <dannyboy@FreeBSD.org> | 2001-05-30 09:04:24 +0800 |
---|---|---|
committer | dannyboy <dannyboy@FreeBSD.org> | 2001-05-30 09:04:24 +0800 |
commit | f974544b519d218cc20ad7edb042ee870a7ebf3d (patch) | |
tree | c70c4e65122e9026e46f5d7a64c5c6d0bf345c78 /ftp/lukemftpd | |
parent | 71ae02cd7e63cd4e70cf028224255731972104cf (diff) | |
download | freebsd-ports-graphics-f974544b519d218cc20ad7edb042ee870a7ebf3d.tar.gz freebsd-ports-graphics-f974544b519d218cc20ad7edb042ee870a7ebf3d.tar.zst freebsd-ports-graphics-f974544b519d218cc20ad7edb042ee870a7ebf3d.zip |
Fix wtmp and utmp logging.
PR: 27720
Submitted by: maintainer
Diffstat (limited to 'ftp/lukemftpd')
-rw-r--r-- | ftp/lukemftpd/Makefile | 1 | ||||
-rw-r--r-- | ftp/lukemftpd/files/patch-ftpd.c | 53 | ||||
-rw-r--r-- | ftp/lukemftpd/files/patch-logutmp.c | 20 | ||||
-rw-r--r-- | ftp/lukemftpd/files/patch-logwtmp.c | 34 | ||||
-rw-r--r-- | ftp/lukemftpd/files/patch-src-Makefile.in | 12 |
5 files changed, 120 insertions, 0 deletions
diff --git a/ftp/lukemftpd/Makefile b/ftp/lukemftpd/Makefile index 72d7c8e2790..6a0b6de5e33 100644 --- a/ftp/lukemftpd/Makefile +++ b/ftp/lukemftpd/Makefile @@ -7,6 +7,7 @@ PORTNAME= lukemftpd PORTVERSION= 1.1 +PORTREVISION= 1 CATEGORIES= ftp ipv6 MASTER_SITES= ftp://ftp.netbsd.org/pub/NetBSD/misc/lukemftp/ \ ftp://ftp.nuug.no/pub/anders/distfiles/ diff --git a/ftp/lukemftpd/files/patch-ftpd.c b/ftp/lukemftpd/files/patch-ftpd.c new file mode 100644 index 00000000000..c0d938fb5fc --- /dev/null +++ b/ftp/lukemftpd/files/patch-ftpd.c @@ -0,0 +1,53 @@ +--- src/ftpd.c.orig Wed Apr 25 08:25:43 2001 ++++ src/ftpd.c Sat May 26 16:46:35 2001 +@@ -102,6 +102,8 @@ + * FTP server. + */ + ++#define NO_UTMP ++ + #define FTP_NAMES + + #include "lukemftpd.h" +@@ -780,9 +782,9 @@ + if (logged_in) { + #ifdef NO_UTMP + if (dowtmp) +- logwtmp(ttyline, "", ""); ++ ftpd_logwtmp(ttyline, "", ""); + if (doutmp) +- logout(utmp.ut_line); ++ ftpd_logout(utmp.ut_line); + #endif /* NO_UTMP */ + } + /* reset login state */ +@@ -912,7 +914,7 @@ + /* open wtmp before chroot */ + #ifdef NO_UTMP + if (dowtmp) +- logwtmp(ttyline, pw->pw_name, remotehost); ++ ftpd_logwtmp(ttyline, pw->pw_name, remotehost); + + /* open utmp before chroot */ + if (doutmp) { +@@ -921,7 +923,7 @@ + (void)strncpy(utmp.ut_name, pw->pw_name, sizeof(utmp.ut_name)); + (void)strncpy(utmp.ut_host, remotehost, sizeof(utmp.ut_host)); + (void)strncpy(utmp.ut_line, ttyline, sizeof(utmp.ut_line)); +- login(&utmp); ++ ftpd_login(&utmp); + } + #endif /* NO_UTMP */ + +@@ -2155,9 +2157,9 @@ + if (logged_in) { + #ifdef NO_UTMP + if (dowtmp) +- logwtmp(ttyline, "", ""); ++ ftpd_logwtmp(ttyline, "", ""); + if (doutmp) +- logout(utmp.ut_line); ++ ftpd_logout(utmp.ut_line); + #endif /* NO_UTMP */ + #ifdef KERBEROS + if (!notickets && krbtkfile_env) diff --git a/ftp/lukemftpd/files/patch-logutmp.c b/ftp/lukemftpd/files/patch-logutmp.c new file mode 100644 index 00000000000..357d6992877 --- /dev/null +++ b/ftp/lukemftpd/files/patch-logutmp.c @@ -0,0 +1,20 @@ +--- src/logutmp.c.old Sat May 26 16:07:13 2001 ++++ src/logutmp.c Sat May 26 16:07:39 2001 +@@ -45,7 +45,7 @@ + */ + + void +-login(const UTMP *ut) ++ftpd_login(const UTMP *ut) + { + UTMP ubuf; + +@@ -85,7 +85,7 @@ + } + + int +-logout(const char *line) ++ftpd_logout(const char *line) + { + UTMP ut; + int rval; diff --git a/ftp/lukemftpd/files/patch-logwtmp.c b/ftp/lukemftpd/files/patch-logwtmp.c new file mode 100644 index 00000000000..fde4bf76212 --- /dev/null +++ b/ftp/lukemftpd/files/patch-logwtmp.c @@ -0,0 +1,34 @@ +--- src/logwtmp.c.old Sat May 26 16:08:11 2001 ++++ src/logwtmp.c Sat May 26 16:15:20 2001 +@@ -46,10 +46,30 @@ + * after login, but before logout). + */ + void +-logwtmp(const char *line, const char *name, const char *host) ++ftpd_logwtmp(const char *line, const char *name, const char *host) + { + struct utmp ut; + struct stat buf; ++ ++ if (strlen(host) > UT_HOSTSIZE) { ++ struct addrinfo hints, *res; ++ int error; ++ static char hostbuf[BUFSIZ]; ++ ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_family = PF_UNSPEC; ++ error = getaddrinfo(host, NULL, &hints, &res); ++ if (error) ++ host = "invalid hostname"; ++ else { ++ getnameinfo(res->ai_addr, res->ai_addrlen, ++ hostbuf, sizeof(hostbuf), NULL, 0, ++ NI_NUMERICHOST); ++ host = hostbuf; ++ if (strlen(host) > UT_HOSTSIZE) ++ host[UT_HOSTSIZE] = '\0'; ++ } ++ } + + if (fd < 0 && (fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0) + return; diff --git a/ftp/lukemftpd/files/patch-src-Makefile.in b/ftp/lukemftpd/files/patch-src-Makefile.in new file mode 100644 index 00000000000..c10312d6b11 --- /dev/null +++ b/ftp/lukemftpd/files/patch-src-Makefile.in @@ -0,0 +1,12 @@ +--- src/Makefile.in.old Sat May 26 16:33:44 2001 ++++ src/Makefile.in Sat May 26 16:34:32 2001 +@@ -22,8 +22,7 @@ + INSTALL = @INSTALL@ + + PROG = ftpd +-OBJS = cmds.o conf.o ftpd.o ftpcmd.o popen.o @LSOBJS@ +-# removed: logutmp.o logwtmp.o ++OBJS = cmds.o conf.o ftpd.o ftpcmd.o popen.o logutmp.o logwtmp.o @LSOBJS@ + + all: ${PROG} + |