Query about setuid()

J. Montgomery johnm at nvuxd.UUCP
Thu Feb 7 11:21:41 AEST 1985


<eat me>

I have run the following program on a System V VAX and on a
newly aquired Pyramid 90x (I ran it setuid to uucp):

#include <stdio.h>

main()
{
        int Uid, Euid;

        Uid = getuid();
        Euid = geteuid();
        printf("uid = %d euid = %d\n", Uid, Euid);

        printf("setuid(%d) returns %d\n", Uid, setuid(Uid));
        printf("uid = %d euid = %d\n", getuid(), geteuid());

        printf("setuid(%d) returns %d\n", Euid, setuid(Euid));
        printf("uid = %d euid = %d\n", getuid(), geteuid());
}

on the VAX (USG 5.0.5) it gives

uid = 882 euid = 5
setuid(882) returns 0
uid = 882 euid = 882
setuid(5) returns 0
uid = 882 euid = 5

on the Pyramid it gives

uid = 100 euid = 5
setuid(100) returns -1
uid = 100 euid = 100
setuid(5) returns -1
uid = 100 euid = 100

I'm wondering which is correct.  The behavior of the Pyramid will
break some things I have on the VAX (including, I believe, the
honey danber uucp).  I'm assuming that (at least in the att universe)
the Pyramid is broken.  What should 4.2 do?  Please reply by mail,
I'll forward or post replies if there is interest.
-- 
	John Montgomery
	Bell Communications Research
	...{allegra,ihnp4}!nvuxd!johnm



More information about the Comp.unix.wizards mailing list