Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jan 2001 16:20:17 +0100 (CET)
From:      Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/24610: [PATCH] make inetd log hostnames when specifying -l twice
Message-ID:  <200101241520.f0OFKH826314@curry.mchp.siemens.de>

next in thread | raw e-mail | index | archive | help

>Number:         24610
>Category:       bin
>Synopsis:       [PATCH] make inetd log hostnames when specifying -l twice
>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:   Wed Jan 24 07:30:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Andre Albsmeier
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
>Environment:

All FreeBSD versions.

>Description:

When specifying -l inetd logs the IP address of succesful connections.
With this patch, the hostname is logged instead of the IP address
when -l is specified twice.

>How-To-Repeat:

run inetd -l and watch /var/log/messages while connecting to an
inetd service.

>Fix:

The patch implements the above suggestion in inetd.c and documents
it in inetd.8. The fact that a (possibly time consuming) DNS lookup
can be needed has been documented as well.

--- usr.sbin/inetd/inetd.c.ORI	Wed Jan 24 11:32:17 2001
+++ usr.sbin/inetd/inetd.c	Wed Jan 24 15:49:24 2001
@@ -310,7 +310,7 @@
 			options |= SO_DEBUG;
 			break;
 		case 'l':
-			log = 1;
+			log++;
 			break;
 		case 'R':
 			getvalue(optarg, &toomany,
@@ -566,7 +566,7 @@
 						  peer.sa_len,
 						  pname, sizeof(pname),
 						  NULL, 0, 
-						  NI_NUMERICHOST|
+						  (log > 1 ? 0 : NI_NUMERICHOST) |
 						  NI_WITHSCOPEID);
 				      pnm = pname;
 				    }
@@ -575,7 +575,7 @@
 						peer.sa_len,
 						pname, sizeof(pname),
 						NULL, 0, 
-						NI_NUMERICHOST|
+						(log > 1 ? 0 : NI_NUMERICHOST) |
 						NI_WITHSCOPEID);
 				    pnm = pname;
 			    }
--- usr.sbin/inetd/inetd.8.ORI	Wed Jan 24 15:49:53 2001
+++ usr.sbin/inetd/inetd.8	Wed Jan 24 15:54:29 2001
@@ -79,7 +79,9 @@
 .It Fl d
 Turn on debugging.
 .It Fl l
-Turn on logging of successful connections.
+Turn on logging of successful connections. If specified twice,
+the address is converted into a name which could result in a
+(possibly time consuming) DNS lookup.
 .It Fl w
 Turn on TCP Wrapping for external services.
 See the

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101241520.f0OFKH826314>