duplicate "nobody" - SGI

This is a discussion on duplicate "nobody" - SGI ; Hello I have found a problem with getpwent on IRIX 6.5 (6.5.13f): It seems the standard /etc/passwd has two different entries for "nobody" nobody:x:60001:60001:SVR4 nobody uid:/dev/null:/dev/null nobody:x:-2:-2 riginal nobody uid:/dev/null:/dev/null but retrieving all the entries using getpwent, returns two "nobody" ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: duplicate "nobody"

  1. duplicate "nobody"


    Hello


    I have found a problem with getpwent on IRIX 6.5 (6.5.13f):
    It seems the standard /etc/passwd has two different entries
    for "nobody"

    nobody:x:60001:60001:SVR4 nobody uid:/dev/null:/dev/null
    nobody:x:-2:-2riginal nobody uid:/dev/null:/dev/null

    but retrieving all the entries using getpwent, returns two
    "nobody" entries with uid=60001.

    I guess is something nsd related, but I have no idea about
    how to get the two different uids...

    ---------------------------------------------------------------------------
    #include
    #include
    #include
    #include

    main( int argc, char **argv)
    {
    register struct passwd *p;
    int f=0;


    setpwent();

    while ((p = getpwent()) != NULL)
    {
    fprintf(stdout,"%s:%d\n",p->pw_name,p->pw_uid);
    f++;
    }
    if (0 == f) perror("getpwent");

    endpwent();
    }
    ---------------------------------------------------------------------------


    --
    finger spd@shiva.cps.unizar.es for PGP /
    ..mailcap tip of the day: / La vida es una carcel
    application/ms-tnef; cat '%s' > /dev/null / con las puertas abiertas
    text/x-vcard; cat '%s' > /dev/null / (A. Calamaro)

  2. Re: duplicate "nobody"

    In article ,
    J.A. Gutierrez wrote:
    : I have found a problem with getpwent on IRIX 6.5 (6.5.13f):
    : It seems the standard /etc/passwd has two different entries
    : for "nobody"

    : nobody:x:60001:60001:SVR4 nobody uid:/dev/null:/dev/null
    : nobody:x:-2:-2riginal nobody uid:/dev/null:/dev/null

    That second one is the old style, the first one is the new style.
    SVR4 made the id's unsigned, and reserved a few numbers for special
    purposes.

    : but retrieving all the entries using getpwent, returns two
    : "nobody" entries with uid=60001.

    : I guess is something nsd related, but I have no idea about
    : how to get the two different uids...

    It's supposed to be that way -- the -2 version is automagically
    translated by NFS, and nsd is build on top of NFS.
    --
    Rome was built one paycheck at a time. -- Walter Roberson

  3. Re: duplicate "nobody"

    >>>>> "roberson" == Walter Roberson writes:

    roberson> In article ,
    roberson> J.A. Gutierrez wrote:

    roberson> : but retrieving all the entries using getpwent, returns two
    roberson> : "nobody" entries with uid=60001.

    roberson> : I guess is something nsd related, but I have no idea about
    roberson> : how to get the two different uids...

    roberson> It's supposed to be that way -- the -2 version is automagically
    roberson> translated by NFS, and nsd is build on top of NFS.

    Um, not exactly. Yes, nsd uses NFS as transport, yes, NFS automagics
    -2 to 60001, but no, NFS does not automagics for getpwent - libc does
    that for any UID which is less then 0 or greater then MAXUID.

    And to answer J.A. question - this is by design and it's not nsd and
    you cannot get -2 or in fact -anything from getpwent.

    max


  4. Re: duplicate "nobody"

    Max Matveev wrote:
    :>>>>> "roberson" == Walter Roberson writes:

    : roberson> It's supposed to be that way -- the -2 version is automagically
    : roberson> translated by NFS, and nsd is build on top of NFS.

    : Um, not exactly. Yes, nsd uses NFS as transport, yes, NFS automagics
    : -2 to 60001, but no, NFS does not automagics for getpwent

    Yes, you are right:

    nsadmin cat passwd.byname | grep nobody
    nobody:x:60001:60001:SVR4 nobody uid:/dev/null:/dev/null
    nobody:x:-2:-2riginal nobody uid:/dev/null:/dev/null

    : - libc does
    : that for any UID which is less then 0 or greater then MAXUID.

    That explains why the same code compiled and linked statically
    on 6.2 returns the two different UIS's

    : And to answer J.A. question - this is by design and it's not nsd and
    : you cannot get -2 or in fact -anything from getpwent.

    OK, I've found the solution:

    extern int _getpwent_no_yp;
    _getpwent_no_yp=1;

    before the setpwent()/getpwent() loop.

    (it is for a chsh implementation...)


    --
    finger spd@shiva.cps.unizar.es for PGP /
    ..mailcap tip of the day: / La vida es una carcel
    application/ms-tnef; cat '%s' > /dev/null / con las puertas abiertas
    text/x-vcard; cat '%s' > /dev/null / (A. Calamaro)

+ Reply to Thread