From owner-freebsd-bugs@FreeBSD.ORG Fri Nov 28 15:30:35 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 51E0816A4CE for ; Fri, 28 Nov 2003 15:30:35 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 826DD43FBF for ; Fri, 28 Nov 2003 15:30:21 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id hASNULFY048245 for ; Fri, 28 Nov 2003 15:30:21 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id hASNULZB048244; Fri, 28 Nov 2003 15:30:21 -0800 (PST) (envelope-from gnats) Resent-Date: Fri, 28 Nov 2003 15:30:21 -0800 (PST) Resent-Message-Id: <200311282330.hASNULZB048244@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Nick Leuta Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A6B4F16A4CF for ; Fri, 28 Nov 2003 15:23:22 -0800 (PST) Received: from falcon.lipetsk.ru (falcon.lipetsk.ru [195.34.224.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id A4FA043F3F for ; Fri, 28 Nov 2003 15:23:21 -0800 (PST) (envelope-from skynick@stu.lipetsk.ru) Received: from lstu by falcon.lipetsk.ru with UUCP id ; Sat, 29 Nov 2003 02:23:06 +0300 Received: from chuck2.lstu (chuck2.lstu [192.168.15.7]) by maverick.stu.int (8.9.3/8.8.5) with ESMTP id CAA23001 +0300 (MSK) Received: by chuck2.lstu (Postfix, from userid 1000) id 94B6349A29; Sat, 29 Nov 2003 02:26:34 +0300 (MSK) Message-Id: <20031128232634.94B6349A29@chuck2.lstu> Date: Sat, 29 Nov 2003 02:26:34 +0300 (MSK) From: Nick Leuta To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/59773: ftpd(8)/FreeBSD 5: IP address of the client connected to virtual host isn't logged X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Nick Leuta List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2003 23:30:35 -0000 X-List-Received-Date: Fri, 28 Nov 2003 23:30:35 -0000 X-List-Received-Date: Fri, 28 Nov 2003 23:30:35 -0000 X-List-Received-Date: Fri, 28 Nov 2003 23:30:35 -0000 >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: