NetBSD Problem Report #8101

Received: (qmail 5221 invoked from network); 28 Jul 1999 09:33:32 -0000
Message-Id: <199907280933.CAA09997@nooksack.ldc.cs.wwu.edu>
Date: Wed, 28 Jul 1999 02:33:30 -0700 (PDT)
From: lha@stacken.kth.se
Reply-To: lha@stacken.kth.se
To: gnats-bugs@gnats.netbsd.org
Subject: inetd doesn't take care of foo[46] in all places
X-Send-Pr-Version: www-1.0

>Number:         8101
>Category:       bin
>Synopsis:       inetd doesn't take care of foo[46] in all places
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 28 02:35:00 +0000 1999
>Closed-Date:    Thu Jul 29 16:24:30 +0000 1999
>Last-Modified:  Thu Jul 29 16:25:00 +0000 1999
>Originator:     Love Hörnquist-Åstrand
>Release:        currrent as of Jul 28 1998
>Organization:
Stacken, KTH, Sweden
>Environment:
NetBSD mulet.e.kth.se 1.4H NetBSD 1.4H

>Description:
Inetd doesn't handle the tcp[46] case and you end up with syslog-
messages like:

Jul 28 10:29:56 mulet inetd[3879]: connection from datan.foo, service 23 (tcp4)

>How-To-Repeat:

use tcp[46] in inetd.conf
>Fix:

--- inetd.c.orig        Wed Jul 28 11:24:37 1999
+++ inetd.c     Wed Jul 28 11:22:43 1999
@@ -660,8 +660,26 @@
                fromhost(&req);
                denied = !hosts_access(&req);
                if (denied || lflag) {
+                       char proto[40];
+                       int i;
+
+                       i = strlen (sep->se_proto);
+
+                       switch (sep->se_proto[i-1]) {
+                       case '4':
+                       case '6':
+                               i = MIN(sizeof(proto),i);
+                               strncpy(proto, sep->se_proto, i);
+                               proto[i-1] = '\0';
+                               break;
+                       default:
+                               strncpy(proto, sep->se_proto, sizeof(proto));
+                               proto[sizeof(proto)-1] = '\0';
+                               break;
+                       }
+
                        sp = getservbyport(sep->se_ctrladdr_in.sin_port,
-                           sep->se_proto);
+                                          proto);
                        if (sp == NULL) {
                                (void)snprintf(buf, sizeof buf, "%d",
                                    ntohs(sep->se_ctrladdr_in.sin_port));

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: itojun 
State-Changed-When: Wed Jul 28 03:58:44 PDT 1999 
State-Changed-Why:  
fixed using getnameinfo().  could you please test the latest code if possible? 
State-Changed-From-To: feedback->closed 
State-Changed-By: itojun 
State-Changed-When: Thu Jul 29 09:24:30 PDT 1999 
State-Changed-Why:  
fixed 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.