NetBSD Problem Report #23049

Received: (qmail 15838 invoked by uid 605); 4 Oct 2003 00:43:54 -0000
Message-Id: <20031004004353.5814011152@narn.netbsd.org>
Date: Sat,  4 Oct 2003 00:43:53 +0000 (UTC)
From: jeffi@rcn.com
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: jeffi@rcn.com
To: gnats-bugs@gnats.NetBSD.org
Subject: inetd hangs, and does not exit when passed a non existent config file
X-Send-Pr-Version: www-1.0

>Number:         23049
>Category:       bin
>Synopsis:       inetd hangs, and does not exit when passed a non existent config file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 04 00:44:00 +0000 2003
>Closed-Date:    
>Last-Modified:  Sun Apr 30 10:23:56 +0000 2006
>Originator:     Jeff Ito
>Release:        NetBSD 1.6ZC
>Organization:
>Environment:
NetBSD netbsd 1.6ZC NetBSD 1.6ZC (LAB) #0: Sun Sep 21 23:12:05 EDT 2003 root@netbsd:/q/build/obj/sys/arch/i386/compile/LAB i386
>Description:
inetd hangs and does not exit when passed a non existent config file
>How-To-Repeat:
$ inetd /bah
>Fix:
Index: inetd.c
===================================================================
RCS file: /opt/cvs/nbsd/src/usr.sbin/inetd/inetd.c,v
retrieving revision 1.93
diff -u -r1.93 inetd.c
--- inetd.c     7 Aug 2003 11:25:21 -0000       1.93
+++ inetd.c     4 Oct 2003 00:40:19 -0000
@@ -798,7 +798,7 @@

        if (!setconfig()) {
                syslog(LOG_ERR, "%s: %m", CONFIG);
-               return;
+               exit(1);
        }
        for (sep = servtab; sep != NULL; sep = sep->se_next)
                sep->se_checked = 0;

>Release-Note:
>Audit-Trail:

From: Jeff Ito <jeffi@rcn.com>
To: gnats-bugs@NetBSD.org
Cc:  
Subject: Re: bin/23049
Date: Fri, 19 Mar 2004 09:52:54 -0500

 As the previous patch stands, inetd would exit if it received a HUP
 after it's config file has been deleted.  This was brought up when a
 similar patch was submitted to the FreeBSD gnats.  I am uncertain of
 the scenarios where this would be of concern, however I have changed
 the behavior to check for the existence of the configuration file at
 the initial startup of inetd.

 Index: inetd.c
 ===================================================================
 RCS file: /cvs/nbsd/src/usr.sbin/inetd/inetd.c,v
 retrieving revision 1.94
 diff -u -r1.94 inetd.c
 --- inetd.c     21 Oct 2003 02:43:37 -0000      1.94
 +++ inetd.c     21 Jan 2004 17:43:11 -0000
 @@ -446,7 +446,7 @@
  int
  main(int argc, char *argv[])
  {
 -       int             ch, n, reload = 1;
 +       int             ch, fd, n, reload = 1;

         while ((ch = getopt(argc, argv,
  #ifdef LIBWRAP
 @@ -474,6 +474,13 @@

         if (argc > 0)
                 CONFIG = argv[0];
 +
 +       if ((fd = open(CONFIG, O_RDONLY)) < 0) {
 +               syslog(LOG_ERR, "%s: %m", CONFIG);
 +               exit(1);
 +       }
 +
 +       close(fd);

         if (!debug)
                 daemon(0, 0);


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.