[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[no subject]



        Written by Dean P. Junk (dpjunk@mmm.com)

        Displays all interactive users on the system along with
        the count of logins, name, location, and phone.

I first compiled it with standard elf gcc and libs. Result:

[jeffrey]:~/src/user$ user.elf
Users on node kadayou Linux i486 @ Wed May  1 14:22:56 1996 :

User Name  Count  Real Name             Location          Phone           
---------  -----  --------------------  ----------------  ----------------
jeffrey        1  Jeffrey Ebert                                           

Total number of users are 1.

Then, I switched to aout gcc and libs using the debian aout
development tools. Result:

[jeffrey]:~/src/user$ user.aout
user *error* : Username <jeffrey> not found in passwd!
, status: -1

Here is the offending code:

131              /* Get passwd information for the user */
132              if ((pwdd = getpwnam(newname)) == NULL)
133              {
134                   sprintf (msg, "Username <%s> not found in passwd!\n", 
135                            newname);
136                   ExitNow (msg, -1);
137              }

getpwnam is returning NULL in the aout version, but not in the elf
version. Running strace on the program doesn't reveal anything
unusual:

open("/etc/passwd", O_RDONLY)           = 4
brk(0xa000)                             = 0xa000
fstat(4, {st_mode=S_IFREG|0644, st_size=1244, ...}) = 0
brk(0xb000)                             = 0xb000
read(4, "root:L8w7Az9EPme6A:0:0:root:/roo"..., 4096) = 1244
close(4)                                = 0

The format of my /etc/passwd file looks ok. I will submit this as a
bug against libc4 unless someone can suggest something that I am
missing.

Jeff


Reply to: