[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[P]get[u|g|eu|eg]id bug?



I wrote two little test programs that simply prints the several IDs
(effective/real user/group).

I used mintlib 46.

Version 1 (get*id(2)-routines):

#include <sys/types.h>
#include <unistd.h>

main()
{
	printf("uid: %d\neuid: %d\ngid: %d\negid\n",
		(int) getuid(), (int) geteuid(), 
		(int) getgid(), (int) getegid());
}

Version 2 (MiNT macros):

#include <mintbind.h>

main()
{
	printf("uid: %d\neuid: %d\ngid: %d\negid\n",
		(int) Pgetuid(), (int) Pgeteuid(), 
		(int) Pgetgid(), (int) Pgetegid());
}

The program's owner was bin (uid 3), its group root (uid 0). When I
started it as user foo (uid 202) in group bar (301), however, the output
was (both versions):

	uid: 0
	euid: 3
	gid: 0
	egid: 0 

When I set the setuid-bit of my test program, the output was:

	uid: 0
	euid: 202
	gid: 0
	egid: 0 

That looks like an error in these routines, doesn't it?

Tschuess

Jens
-- 
+--------------------------------------------------------------------+         
|Jens M. Felderhoff                                                  | 
+--------------------------------------------------------------------+         
|e-mail: jmf@infko.uni-koblenz.de |  Fido:  2:2454/95.10@fidonet.org |
|                                 |  NeST: 90:400/601.10@nest.ftn    |
+--------------------------------------------------------------------+