[ale] Unexpected behavior
Danny Cox
danscox at mindspring.com
Thu Dec 11 10:02:46 EST 2003
Denny,
On Wed, 2003-12-10 at 17:41, Denny Chambers wrote:
> So let me set up the scenario:
>
> First here is a simple test program I use:
>
> --start copy
> #include <sys/types.h>
> #include <unistd.h>
> #include <stdio.h>
>
> main(int argc, char *argv) {
> FILE *fd = NULL;
>
> setegid(100);
> seteuid(501);
> if((fd = fopen("./foo", "r")) != NULL){
> printf("User (%d/%d) has rights to file\n", geteuid(), getegid());
> }
> else{
> printf("User (%d/%d) does not have rights file\n", geteuid(),
> getegid());
> }
> }
> --stop copy
This is the group list problem. All users have a list of groups they
belong to. You must wipe this out IN ADDITION TO setting the egid. See
groups(1) to list the groups you belong to, and getgroups(2) and
setgroups(2) for an API to [gs]et the group list.
--
kernel, n.: A part of an operating system that preserves the
medieval traditions of sorcery and black art.
Danny
More information about the Ale
mailing list