From owner-freebsd-stable Mon Aug 7 13:13:57 2000 Delivered-To: freebsd-stable@freebsd.org Received: from mail.wgate.com (mail.wgate.com [38.219.83.4]) by hub.freebsd.org (Postfix) with ESMTP id C15B837B876 for ; Mon, 7 Aug 2000 13:13:50 -0700 (PDT) (envelope-from kway@wgate.com) Received: from way.eng.tvol.net ([10.32.2.95]) by mail.wgate.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id Q3QWQRG2; Mon, 7 Aug 2000 16:13:45 -0400 Received: from localhost (kevin@localhost) by way.eng.tvol.net (8.9.3/8.9.3/way) with ESMTP id QAA22772 for ; Mon, 7 Aug 2000 16:13:28 -0400 (EDT) (envelope-from kway@wgate.com) X-Authentication-Warning: way.eng.tvol.net: kevin owned process doing -bs Date: Mon, 7 Aug 2000 16:13:28 -0400 (EDT) From: Kevin Way X-Sender: kevin@way.eng.tvol.net To: freebsd-stable@freebsd.org Subject: Problems with the getpwnam() function Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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