prot.c (281B)
1 #include "prot.h" 2 3 #include <sys/types.h> 4 #include <unistd.h> 5 #include <grp.h> 6 7 int prot_gid(gid_t gid) 8 { 9 if (setgroups(1,&gid) == -1) return -1; 10 return setgid(gid); /* _should_ be redundant, but on some systems it isn't */ 11 } 12 13 int prot_uid(uid_t uid) 14 { 15 return setuid(uid); 16 }