getuid, geteuid broke?

local src Local etc. local at jim.odr.oz.au
Fri Nov 4 23:13:30 AEST 1988


Reply-to: local at jim.odr.oz.au (local src Local etc.)



getuid() seems to always return the effective user id, and getgid()
always returns the effective group id. I compiled and ran the following...

/* tmp.c */
main()
{
  printf("getuid = %d, geteuid = %d\n",getuid(),geteuid());
  printf("getgid = %d, getegid = %d\n",getgid(),getegid());
}

57% cc tmp.c
58% a.out
getuid = 290, geteuid = 290
getgid = 6, getegid = 6
59% whoami
local
60% su
Password:

# 51% a.out
getuid = 0, geteuid = 0
getgid = 0, getegid = 0
# 52% whoami
root
# 53% 

  This is wrong, isn't it. I thought that getuid() should return the
same thing after I did the su.
  I discovered this in emacs (18.52) using the functions (user-uid)
and (user-real-uid) which call geteuid() and getuid() respectivly. Am
I doing something wrong here, how do I fix it.

  We are running Ultrix 2.0 on a MicroVax II.

Brian Wallis (brw at jim.odr.oz)		    O'Dowd Research P/L.
	(03) 562-0100 Fax: (03) 562-0616,
	Telex: Jacobs Radio (Bayswater) 152093



More information about the Comp.unix.ultrix mailing list