Bug 103921 - useradd crashes adding a user without specifying gid (like webalizer install does)
useradd crashes adding a user without specifying gid (like webalizer install ...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: shadow-utils (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Vrabec
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-09-07 11:45 EDT by Peter Bieringer
Modified: 2007-04-18 12:57 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-04-18 04:38:41 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Peter Bieringer 2003-09-07 11:45:21 EDT
Description of problem:
useradd crashes here during later installation of webalizer in the adduser step.

Version-Release number of selected component (if applicable):
shadow-utils-4.0.3-6

How reproducible:
Always

Steps to Reproduce:
1./usr/sbin/adduser -c "test" -u 700-s /sbin/nologin  -r -d /tmp/test test

    

Actual Results:  segfaulting

Expected Results:  not segfaulting

Additional info:

Looks like this is a different issue than #86490

# strace  -s 512 /usr/sbin/adduser -c "test" -u 700-s /sbin/nologin  -r -d
/tmp/test test

Last strace lines:

open("/var/log/faillog", O_RDWR)        = -1 ENOENT (No such file or directory)
open("/var/log/lastlog", O_RDWR)        = 9
lseek(9, 204400, SEEK_SET)              = 204400
write(9,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
292) = 292
close(9)                                = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

gdb:

This GDB was configured as "i386-redhat-linux-gnu"...(no debugging symbols found)...
Core was generated by `/usr/sbin/adduser -c test -u 700 -s /sbin/nologin -r -d
/tmp/test test'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libsafe.so.2...done.
Loaded symbols for /lib/libsafe.so.2
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
#0  0x400be0a4 in strcmp () from /lib/libc.so.6
(gdb) bt
#0  0x400be0a4 in strcmp () from /lib/libc.so.6
#1  0x0804d16e in strcpy ()
#2  0x0804aaf3 in strcpy ()
#3  0x0804be78 in strcpy ()
#4  0x0804c55e in strcpy ()
#5  0x400615cd in __libc_start_main () from /lib/libc.so.6

digging through current source in useradd.c this must happen here or later:

        /*
         * Put the new (struct passwd) in the table.
         */

        if (!pw_update (&pwent)) {
                fprintf (stderr,
                         _("%s: error adding new password entry\n"), Prog);
                exit (E_PW_UPDATE);
        }


It does *not* crash, if a group id of an existing group was given with option
"-g $gid"
Comment 1 Milan Kerslager 2003-10-23 00:26:27 EDT
I can't reproduce this on my full RH 9 installation.
Comment 2 Peter Bieringer 2004-01-08 08:25:29 EST
Reproduced on another system and reason found:
Both systems have libsafe installed, deinstalling libsafe bring this
back to work.

Therefore it looks like "useradd" contain some unclean code.

Note You need to log in before you can comment on or make changes to this bug.