Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Sep 2002 21:17:30 -0700 (PDT)
From:      John Mechalas <seagull@aracnet.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/43501: getpwnam, getpwuid fail when linking against Berkley DB v2
Message-ID:  <200209300417.g8U4HUZK004325@www.freebsd.org>

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

>Number:         43501
>Category:       bin
>Synopsis:       getpwnam, getpwuid fail when linking against Berkley DB v2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 29 21:20:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     John Mechalas
>Release:        4.6.2-RELEASE
>Organization:
>Environment:
FreeBSD medley 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #0: Sat Sep 28 11:05:14 PDT 2002     root@medley:/usr/src/sys/compile/MEDLEY  i386

>Description:
When linking a program against libdb2, from the Berkley DB v2 package,
calls to getpwuid(2) and getpwnam(2) fail on EINVAL.  Note that you 
don't actually have to invoke any of the DB functions...merely linking
against the library is enough to cause a failure.

This problem *may* be related to PR bin/21659.

getpw* work if you link against BDB v3 or v4.
>How-To-Repeat:
Compile this program and link with -ldb2:

#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>
#include <stdio.h>
#include <db2/db.h>

int main (int argc, char **argv)
{
        struct passwd *pw;

        pw= getpwuid(getuid());
        if ( pw == NULL ) {
                perror("getpwuid");
                return 1;
        }
        printf("name= %s\n", pw->pw_name);
}


[medley] /local/export1/home/johnm/src/db > make
cc -c main.c -I/usr/local/include
cc -o main main.o -L/usr/local/lib -ldb2
[medley] /local/export1/home/johnm/src/db > ./main 
getpwuid: Invalid argument
[medley] /local/export1/home/johnm/src/db > 


>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209300417.g8U4HUZK004325>