Bug 89192

Summary: Bails on startup because it cannot find '/etc/xinetd.d/(null)'
Product: [Retired] Red Hat Linux Reporter: David Costanzo <david_costanzo>
Component: redhat-config-servicesAssignee: Daniel Walsh <dwalsh>
Status: CLOSED RAWHIDE QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 9CC: david_costanzo
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-05-14 13:29:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
listService read/prints uninitialized buffer none

Description David Costanzo 2003-04-19 21:20:31 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312

Description of problem:
When I run redhat-config-services, it asks me for root password, flashes the
GUI, then exits with the following error message:

    /etc/xinetd.d/(null) [Errno 2] No such file or directory: '/etc/xinetd.d/(null)'

I upgraded from modified RH 7.1 to RH 9, so I'm sure my system is this is a
configuration problem.  However, I also think that this is a bug in
redhat-config-services for two reasons:

1) It might be calling sprintf with a "%s" argument that is NULL.  While glibc
will convert NULL strings as "(null)", the behavior is undefined by the ANSI
specification.  (I haven't looked at the source code, so this is just a guess)

2) The error message is not helpful.


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. log into an xterm
2. run redhat-config-services
3.
 

Actual Results:  redhat-config-services asks me for root password.  I enter it.
 Then it flashes the GUI for 1/10th of a second and exits with the following
error message:

    /etc/xinetd.d/(null) [Errno 2] No such file or directory: '/etc/xinetd.d/(null)'


Expected Results:  The GUI should come up.

Additional info:

I updated from a modified RH 7.1 to RH 9 distribution.
I'm is just a bad reaction to an erronous configuration.
Unfortunatly, I do not know what is wrong with my configuration.  Hopefully,
this will be easy for the developer to spot by inspection.

Comment 1 Daniel Walsh 2003-05-01 12:54:32 UTC
Run a chkconfig --list and see if this has a problem.  Check for a bad link in the
/etc/rc3.d directory.

Dan

Comment 2 David Costanzo 2003-05-02 15:55:43 UTC
Running "chkconfig --list" prints out a bunch of services, then crashes (seg
faults) just after printing the header for "xinetd based services".

Running "symlinks /etc/rc3.d" outputs:

  absolute: /etc/rc3.d/S90ntpd -> /etc/rc.d/init.d/ntpd
  absolute: /etc/rc3.d/S60smb -> /etc/init.d/smb
  absolute: /etc/rc3.d/S90amd -> /etc/rc.d/init.d/amd
  absolute: /etc/rc3.d/S60nfs -> /etc/rc.d/init.d/nfs
  absolute: /etc/rc3.d/S90rstatd -> /etc/rc.d/init.d/rstatd
  absolute: /etc/rc3.d/S90rusersd -> /etc/rc.d/init.d/rusersd

Notice there are no dangling links.


Comment 3 Daniel Walsh 2003-05-02 17:06:14 UTC
chkconfig is the problem.  Redhat-config-services execs chkconfig to get it's data.

Is there anything wierd in the /etc/xinet.d directory?

Dan

Comment 4 David Costanzo 2003-05-03 01:57:39 UTC
I can see that chkconfig crashing would cause problems, but I would still expect
the GUI to present a more informative error message.

I don't see anything strange about the contents of my /etc/xinet.d directory,
but I don't know what I'm looking for.  There are no dangling symbolic links.

I downloaded the 1.3.8 source code for chkconfig, built it, and ran it with the
"--list" option.  It does not crash.  However, the first entry under the xinetd
looks strange.  It's:

    E+ on

There is no file called E+ (or anything like it) in my /etc/xinet.d directory. 
I don't know where the E+ is coming from.

I replaced my chkconfig with the one I just built (I kept the older version 
around for the sake of reproducing the bug).  Now when I run
redhat-config-services it bails with a different error:

/etc/xinetd.d/¤» [Errno 2] No such file or directory: '/etc/xinetd.d/\xa4\xbb'

I presume that the "star double-greaterthan" is the unescaped from of 0xA4 0xBB
in whatever font I'm using.  I'm sure there's some connection between this an
"E+", but it's not obvious to me.

Comment 5 Daniel Walsh 2003-05-07 12:55:02 UTC
Does chkconfig --list list all the files in the /etc/xinit.d directory? 
Could you send me a listing.

Dan

Comment 6 David Costanzo 2003-05-07 18:45:45 UTC
I have appended the requested listing to the end of this post.  I have also done
an "ls -fl /etc/xinetd.d" for comparison.

You will notice that the single discrepency between the two listings is that the
I have a directory called "unused" in my /etc/xinetd.d".  I have verified that
if I remove this directory, the "E+" entry (and the entire problem) goes away. 
However, if I change the name to of the directory from "unused" to anything
else, the directory is (correctly) ignored.  Also, just having a directory
called "unused" causes problems, even if it is empty.

This "unused" directory has been around since 2000, back when my machine was
running RH 7.1 and had a different sys admin.  I don't know who created the
"unused" directory, why it was created, or why it is special.


> /sbin/chkconfig --list
syslog          0:off   1:off   2:on    3:on    4:on    5:on    6:off
crond           0:off   1:off   2:on    3:on    4:on    5:on    6:off
netfs           0:off   1:off   2:off   3:on    4:on    5:on    6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
random          0:off   1:off   2:on    3:on    4:on    5:on    6:off
rawdevices      0:off   1:off   2:off   3:on    4:on    5:on    6:off
xfs             0:off   1:off   2:on    3:on    4:on    5:on    6:off
amd             0:off   1:off   2:off   3:on    4:off   5:on    6:off
xinetd          0:off   1:off   2:off   3:on    4:on    5:on    6:off
dhcrelay        0:off   1:off   2:off   3:off   4:off   5:off   6:off
anacron         0:off   1:off   2:on    3:on    4:on    5:on    6:off
httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
arpwatch        0:off   1:off   2:off   3:off   4:off   5:off   6:off
atd             0:off   1:off   2:off   3:on    4:on    5:on    6:off
autofs          0:off   1:off   2:off   3:on    4:on    5:on    6:off
mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
nscd            0:off   1:off   2:off   3:off   4:off   5:off   6:off
snmptrapd       0:off   1:off   2:off   3:off   4:off   5:off   6:off
keytable        0:off   1:on    2:on    3:on    4:on    5:on    6:off
dhcpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
gpm             0:off   1:off   2:on    3:on    4:on    5:on    6:off
nfs             0:off   1:off   2:off   3:off   4:off   5:off   6:off
ipchains        0:off   1:off   2:on    3:on    4:on    5:on    6:off
rhnsd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
kadmin          0:off   1:off   2:off   3:off   4:off   5:off   6:off
kprop           0:off   1:off   2:off   3:off   4:off   5:off   6:off
krb524          0:off   1:off   2:off   3:off   4:off   5:off   6:off
krb5kdc         0:off   1:off   2:off   3:off   4:off   5:off   6:off
kudzu           0:off   1:off   2:off   3:on    4:on    5:on    6:off
saslauthd       0:off   1:off   2:off   3:off   4:off   5:off   6:off
nfslock         0:off   1:off   2:off   3:on    4:on    5:on    6:off
ntpd            0:off   1:off   2:off   3:off   4:off   5:off   6:off
lisa            0:off   1:off   2:off   3:off   4:off   5:off   6:off
psacct          0:off   1:off   2:off   3:off   4:off   5:off   6:off
winbind         0:off   1:off   2:off   3:off   4:off   5:off   6:off
ups             0:off   1:off   2:off   3:off   4:off   5:off   6:off
ldap            0:off   1:off   2:off   3:off   4:off   5:off   6:off
iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off
apmd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
portmap         0:off   1:off   2:off   3:on    4:on    5:on    6:off
postgresql      0:off   1:off   2:off   3:off   4:off   5:off   6:off
vsftpd          0:off   1:off   2:off   3:off   4:off   5:off   6:off
rarpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
routed          0:off   1:off   2:off   3:off   4:off   5:off   6:off
privoxy         0:off   1:off   2:off   3:off   4:off   5:off   6:off
rstatd          0:off   1:off   2:off   3:off   4:off   5:off   6:off
rusersd         0:off   1:off   2:off   3:off   4:off   5:off   6:off
rwalld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
rwhod           0:off   1:off   2:off   3:off   4:off   5:off   6:off
smb             0:off   1:off   2:off   3:on    4:off   5:on    6:off
sendmail        0:off   1:off   2:on    3:on    4:on    5:on    6:off
squid           0:off   1:off   2:off   3:off   4:off   5:off   6:off
ypxfrd          0:off   1:off   2:off   3:off   4:off   5:off   6:off
ypbind          0:off   1:off   2:off   3:off   4:off   5:off   6:off
yppasswdd       0:off   1:off   2:off   3:off   4:off   5:off   6:off
ypserv          0:off   1:off   2:off   3:off   4:off   5:off   6:off
pcmcia          0:off   1:off   2:on    3:on    4:on    5:on    6:off
irda            0:off   1:off   2:off   3:off   4:off   5:off   6:off
isdn            0:off   1:off   2:on    3:on    4:on    5:on    6:off
cups            0:off   1:off   2:on    3:on    4:on    5:on    6:off
canna           0:off   1:off   2:on    3:on    4:on    5:on    6:off
xinetd based services:
        E+:     on
        chargen-udp:    off
        finger: off
        ntalk:  off
        talk:   off
        rsync:  off
        chargen:        off
        daytime-udp:    off
        daytime:        off
        echo-udp:       off
        echo:   off
        services:       off
        servers:        off
        time-udp:       off
        time:   off
        amandaidx:      off
        sgi_fam:        on
        amanda: off
        comsat: off
        amidxtape:      off
        eklogin:        off
        gssftp: off
        klogin: off
        krb5-telnet:    off
        kshell: off
        ktalk:  off
        cups-lpd:       off

> ls -fl /etc/xinetd.d
total 120
drwxr-xr-x    3 root     root         4096 Apr 19 13:03 ./
drwxr-xr-x   77 root     root         8192 Apr 21 04:04 ../
drwxr-xr-x    2 root     root         4096 Nov 17  2000 unused/
-rw-r--r--    1 root     root          580 Feb 24 16:10 chargen-udp
-rw-r--r--    1 root     root          318 Jan 24 15:52 finger
-rw-r--r--    1 root     root          275 Feb  4 08:04 ntalk
-rw-r--r--    1 root     root          263 Feb  4 08:04 talk
-rw-r--r--    1 root     root          317 Jan 24 23:04 rsync
-rw-r--r--    1 root     root          563 Feb 24 16:10 chargen
-rw-r--r--    1 root     root          438 Feb 24 16:10 daytime-udp
-rw-r--r--    1 root     root          419 Feb 24 16:10 daytime
-rw-r--r--    1 root     root          360 Feb 24 16:10 echo-udp
-rw-r--r--    1 root     root          341 Feb 24 16:10 echo
-rw-r--r--    1 root     root          314 Feb 24 16:10 services
-rw-r--r--    1 root     root          312 Feb 24 16:10 servers
-rw-r--r--    1 root     root          518 Feb 24 16:10 time-udp
-rw-r--r--    1 root     root          497 Feb 24 16:10 time
-rw-r--r--    1 root     root          230 Feb 13 08:15 amandaidx
-rw-r--r--    1 root     root          392 Jan 31 07:22 sgi_fam
-rw-r--r--    1 root     root          321 Feb 13 08:15 amanda
-rw-r--r--    1 root     root          233 Jan 24 15:08 comsat
-rw-r--r--    1 root     root          233 Feb 13 08:15 amidxtape
-rw-r--r--    1 root     root          323 Mar  6 15:09 eklogin
-rw-r--r--    1 root     root          326 Mar  6 15:09 gssftp
-rw-r--r--    1 root     root          310 Mar  6 15:09 klogin
-rw-r--r--    1 root     root          323 Mar  6 15:09 krb5-telnet
-rw-r--r--    1 root     root          308 Mar  6 15:09 kshell
-rw-r--r--    1 root     root          267 Feb 24 15:20 ktalk
-rwxr-xr-x    1 root     root          239 Feb 12 09:51 cups-lpd*


Comment 7 Daniel Walsh 2003-05-08 20:49:52 UTC
I made a fix to chkconfig that should ignore the directory.  Check it out at
ftp://people.redhat.com/dwalsh/chkconfig
I will attempt to get this change into the next release.

Dan

Comment 8 David Costanzo 2003-05-09 04:26:42 UTC
Created attachment 91577 [details]
listService read/prints uninitialized buffer

Because I couldn't see the changes you made, I got nervous that you might have
made a change based on incomplete information that I had given you.  I ended
stepping through the code in the debugging and found the problem.  Hopefully,
you arrived at the same conclusion, but I am submitting this patch just in
case. 

The problem is that listService does not check the return value of 
readXinetdServiceInfo().  When readXinetdServiceInfo() encounters a directory,
it returns -1 and leaves the service parameter untouched.  In short, the "E+"
was coming from This means that In other words the "E+" was coming from reading
uninitialized memory on the stack.

This patch makes listService check the return value.

Comment 9 Daniel Walsh 2003-05-14 13:29:13 UTC
The latest kit on RawHide handles errors in chkconfig better
redhat-config-services-0.8.5-*

Also I have implimented your suggested changes plus some others in chkconfig
chkconfig-1.3.8-* which also should be on rawhide.