Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jan 1996 18:46:24 +0100 (MET)
From:      Åge Røbekk <aagero@aage.aage.priv.no>
To:        freebsd-bugs@freebsd.org
Subject:   getlogin() returns bogus username
Message-ID:  <199601161746.SAA03923@birk04.studby.uio.no>

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

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.

----------------

/* getlogin.c */

#include <stdio.h>
#include <unistd.h>

void main(void)
{
        printf("getlogin: %s\n", getlogin());
}

-----------------



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