Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jan 1996 02:22:42 +0100
From:      Wolfram Schneider <wosch@cs.tu-berlin.de>
To:        "\Ege R\xbekk" <aagero@aage.aage.priv.no>
Cc:        freebsd-bugs@freebsd.org
Subject:   getlogin() returns bogus username
Message-ID:  <199601170122.CAA01429@localhost>
In-Reply-To: <199601161746.SAA03923@birk04.studby.uio.no>
References:  <199601161746.SAA03923@birk04.studby.uio.no>

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

$ man 5 passwd
     While it is possible to have multiple entries with identical login names
     and/or identical user id's, it is usually a mistake to do so.  Routines
     that manipulate these files will often return only one of the multiple
     entries, and that one by random selection.
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Wolfram

Ege Rxbekk writes:
>getlogin() does sometimes return the wrong username, e.g.
>
>$ ./getlogin 
>getlogin: per-stia
>$ id
>uid=1000(aagero) gid=1000(aagero) groups=1000(aagero),0(wheel),2(kmem)
>
>That is, getlogin returns the same bogus name each time I call it. But
>if I login to a new session, e.g. rlogin localhost, getlogin() returns
>the same as getuid(). The user returned from getlogin is usually
>logged in when this happens.



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