Date: Sat, 29 Nov 2003 02:26:34 +0300 (MSK) From: Nick Leuta <skynick@mail.sc.ru> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/59773: ftpd(8)/FreeBSD 5: IP address of the client connected to virtual host isn't logged Message-ID: <20031128232634.94B6349A29@chuck2.lstu> Resent-Message-ID: <200311282330.hASNULZB048244@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 59773 >Category: bin >Synopsis: ftpd(8)/FreeBSD 5: IP address of the client connected to virtual host isn't logged >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Nov 28 15:30:21 PST 2003 >Closed-Date: >Last-Modified: >Originator: Nick Leuta >Release: FreeBSD 4.9-RC i386 >Organization: Lipetsk State Technical University >Environment: System: FreeBSD skynick.stu.lipetsk.ru 4.9-RC FreeBSD 4.9-RC #0: Sun Nov 23 19:53:55 MSK 2003 root@skynick.stu.lipetsk.ru:/usr/src/sys/compile/CORSAIR i386 >Description: Ftpd(8) doesn't log the IP address of the client (only the symbolic name is logged) if the client connects to a virtual host, but it logs the IP address otherwise (and the symbolic name too). >How-To-Repeat: >Fix: diff -urN ftpd.ORI/ftpd.c ftpd/ftpd.c --- ftpd.ORI/ftpd.c Sat Nov 15 14:08:26 2003 +++ ftpd/ftpd.c Thu Nov 27 11:00:22 2003 @@ -2538,8 +2538,11 @@ dolog(struct sockaddr *who) { int error; + char who_name[MAXHOSTNAMELEN]; realhostname_sa(remotehost, sizeof(remotehost) - 1, who, who->sa_len); + error = getnameinfo(who, who->sa_len, + who_name, sizeof(who_name) - 1, NULL, 0, NI_NUMERICHOST); #ifdef SETPROCTITLE #ifdef VIRTUAL_HOSTING @@ -2556,16 +2559,12 @@ if (logging) { #ifdef VIRTUAL_HOSTING if (thishost != firsthost) - syslog(LOG_INFO, "connection from %s (to %s)", - remotehost, hostname); + syslog(LOG_INFO, "connection from %s (%s) to %s", + remotehost, error == 0 ? who_name : "", + hostname); else #endif { - char who_name[MAXHOSTNAMELEN]; - - error = getnameinfo(who, who->sa_len, - who_name, sizeof(who_name) - 1, - NULL, 0, NI_NUMERICHOST); syslog(LOG_INFO, "connection from %s (%s)", remotehost, error == 0 ? who_name : ""); } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031128232634.94B6349A29>