From skynick@stu.lipetsk.ru  Fri Nov 28 15:23:52 2003
Return-Path: <skynick@stu.lipetsk.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A6B4F16A4CF
	for <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>; 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 <S204021AbTK1XXG>;
	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 
	  for <FreeBSD-gnats-submit@freebsd.org> Sat, 29 Nov 2003 02:22:47 +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 <skynick@mail.sc.ru>
Reply-To: Nick Leuta <skynick@mail.sc.ru>
To: FreeBSD-gnats-submit@freebsd.org
Subject: ftpd(8)/FreeBSD 5: IP address of the client connected to virtual host isn't logged
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>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:    yar
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 28 15:30:21 PST 2003
>Closed-Date:    Mon Nov 22 10:27:56 GMT 2004
>Last-Modified:  Mon Nov 22 11:00:42 GMT 2004
>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:
State-Changed-From-To: open->closed 
State-Changed-By: yar 
State-Changed-When: Mon Nov 22 10:27:29 GMT 2004 
State-Changed-Why:  


http://www.freebsd.org/cgi/query-pr.cgi?pr=59773 
Responsible-Changed-From-To: freebsd-bugs->yar 
Responsible-Changed-By: yar 
Responsible-Changed-When: Mon Nov 22 10:28:15 GMT 2004 
Responsible-Changed-Why:  
My area. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59773 

From: Yar Tikhiy <yar@comp.chem.msu.su>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/59773: ftpd(8)/FreeBSD 5: IP address of the client connected to virtual host isn't logged
Date: Mon, 22 Nov 2004 13:56:13 +0300

 OOPS, failed to enter the reason when changing PR's state.
 It's not a real bug, it's more to a style issue, so I'm not
 going to MFC this.
 
 -- 
 Yar
>Unformatted:
