Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Aug 2000 16:13:28 -0400 (EDT)
From:      Kevin Way <kway@wgate.com>
To:        freebsd-stable@freebsd.org
Subject:   Problems with the getpwnam() function
Message-ID:  <Pine.BSF.4.21.0008071612070.22768-100000@way.eng.tvol.net>

next in thread | raw e-mail | index | archive | help

when running through the following section of code, I receive an
interesting crash.  This code did work has worked under previous
versions of FreeBSD, but there seems to be no real reason for this
current problem.


struct passwd *pwd;
/* .... tinkering with other local variables here .... */
/* ..... setting up the tcp ports to listen on ..... */
   if ((pwd = getpwnam("nobody")) != NULL)
     nobody = pwd->pw_uid;



After running the getpwnam command (and yes, user "nobody" does exist),
a crash will ensue.  A backtrace from gdb shows the following lines:
Starting program: /mnt/server/usr/local/wgate/LoginManager/./sm -d

Program received signal SIGSEGV, Segmentation fault.
0x28211d38 in __hash_open () from /usr/lib/libc.so.4
(gdb) bt
#0  0x28211d38 in __hash_open () from /usr/lib/libc.so.4
#1  0x282119fb in dbopen () from /usr/lib/libc.so.4
#2  0x281dbb47 in endpwent () from /usr/lib/libc.so.4
#3  0x281db84f in getpwnam () from /usr/lib/libc.so.4
#4  0x804afa7 in main (argc=2, argv=0xbfbff77c) at sm.c:606
#5  0x804a4ed in _start ()


I was curious if there are currently any known problems with the hash
function as this does occur on multiple FreeBSD4.x machines?  Any
suggested methods for working around this problem?  Any suggestions for
correcting the code if its incorrect?


The crash is reproducable on the following machines:

client42# uname -a
FreeBSD client42.tics35.eng.tvol.net 4.0-STABLE FreeBSD 4.0-STABLE #3:
Mon Jun 26 16:03:06 EDT 2000
root@tics35.eng.tvol.net:/usr/src/sys/compile/TICS  i386

kalowsky-bsd:/usr/local/wgate> uname -a
FreeBSD kalowsky-bsd.eng.tvol.net 4.1-STABLE FreeBSD 4.1-STABLE #9: Fri
Aug  4 11:56:18 EDT 2000
root@kalowsky-bsd.eng.tvol.net:/usr/src/sys/compile/DEVEL  i386




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0008071612070.22768-100000>