From owner-freebsd-ports Mon May 28 14:10:17 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 1E12037B423 for ; Mon, 28 May 2001 14:10:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4SLA2t10860; Mon, 28 May 2001 14:10:02 -0700 (PDT) (envelope-from gnats) Received: from totem.fix.no (totem.fix.no [213.142.66.130]) by hub.freebsd.org (Postfix) with ESMTP id 69E8E37B422 for ; Mon, 28 May 2001 14:02:43 -0700 (PDT) (envelope-from anders@totem.fix.no) Received: by totem.fix.no (Postfix, from userid 1000) id 89CD53D26; Mon, 28 May 2001 23:02:42 +0200 (CEST) Message-Id: <20010528210242.89CD53D26@totem.fix.no> Date: Mon, 28 May 2001 23:02:42 +0200 (CEST) From: Anders Nordby Reply-To: Anders Nordby To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: ports/27720: Fix port: ftp/lukemftpd Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 27720 >Category: ports >Synopsis: Fix port: ftp/lukemftpd >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Mon May 28 14:10:02 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Anders Nordby >Release: FreeBSD 4.3-STABLE i386 >Organization: Fluxpod Information eXchange >Environment: >Description: Fix wtmp and utmp logging. Adds these patches: files/patch-ftpd.c files/patch-logutmp.c files/patch-logwtmp.c files/patch-src-Makefile.in >How-To-Repeat: >Fix: diff -Nur lukemftpd.old/files/patch-ftpd.c lukemftpd/files/patch-ftpd.c --- lukemftpd.old/files/patch-ftpd.c Thu Jan 1 01:00:00 1970 +++ lukemftpd/files/patch-ftpd.c Sat May 26 16:46:55 2001 @@ -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 -Nur lukemftpd.old/files/patch-logutmp.c lukemftpd/files/patch-logutmp.c --- lukemftpd.old/files/patch-logutmp.c Thu Jan 1 01:00:00 1970 +++ lukemftpd/files/patch-logutmp.c Sat May 26 16:07:57 2001 @@ -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 -Nur lukemftpd.old/files/patch-logwtmp.c lukemftpd/files/patch-logwtmp.c --- lukemftpd.old/files/patch-logwtmp.c Thu Jan 1 01:00:00 1970 +++ lukemftpd/files/patch-logwtmp.c Sat May 26 16:15:34 2001 @@ -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 -Nur lukemftpd.old/files/patch-src-Makefile.in lukemftpd/files/patch-src-Makefile.in --- lukemftpd.old/files/patch-src-Makefile.in Thu Jan 1 01:00:00 1970 +++ lukemftpd/files/patch-src-Makefile.in Sat May 26 16:34:56 2001 @@ -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} + >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message