Bug 103921 - useradd crashes adding a user without specifying gid (like webalizer install does)
Summary: useradd crashes adding a user without specifying gid (like webalizer install ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: shadow-utils
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Peter Vrabec
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-09-07 15:45 UTC by Peter Bieringer
Modified: 2007-04-18 16:57 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-04-18 08:38:41 UTC
Embargoed:


Attachments (Terms of Use)

Description Peter Bieringer 2003-09-07 15:45:21 UTC
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 04:26:27 UTC
I can't reproduce this on my full RH 9 installation.

Comment 2 Peter Bieringer 2004-01-08 13:25:29 UTC
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.