From owner-freebsd-questions Tue May 28 15:28:11 2002 Delivered-To: freebsd-questions@freebsd.org Received: from fepC.post.tele.dk (fepC.post.tele.dk [195.41.46.147]) by hub.freebsd.org (Postfix) with ESMTP id 8133337B401 for ; Tue, 28 May 2002 15:28:05 -0700 (PDT) Received: from rafter ([80.63.125.30]) by fepC.post.tele.dk (InterMail vM.4.01.03.23 201-229-121-123-20010418) with SMTP id <20020528222804.KSTJ27513.fepC.post.tele.dk@rafter>; Wed, 29 May 2002 00:28:04 +0200 Message-ID: <00f501c20696$f970de60$6800a8c0@rafter> From: "Daniel Blankensteiner" To: "Jonathan Chen" Cc: References: <005401c2068a$35c1ebf0$6800a8c0@rafter> <20020529100157.B60716@grimoire.chen.org.nz> Subject: Re: I386< List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ----- Original Message ----- From: "Jonathan Chen" > On Tue, May 28, 2002 at 10:56:54PM +0200, Daniel Blankensteiner wrote: > > I have found a weird problem using getlogin() or maybe it is just me that > > is weird ;-) > > [...] > > db# su testuser > > ~% whoami > > testuser > > ~% ./test > > You are logged in as: root > > Your group number is: 1000 > > Your uid is: 1000 > > What is going on? If I ssh to the computer and log in as testuser, the > > program > > works fine. Programs(proccess) that change user and use getlogin() may have > > a security problem or am I just missing som "su" info? > > btw what is the difference between a real and effective user? > > getlogin() is working fine. You should be using getuid(2) and geteuid(2) > to determine real and effective user. But why does getlogin() give me "root", when I have su'ed to testuser? And what is the difference between a real and effective user? br db To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message