creds.c (566B)
1 #include <linux/cred.h> 2 3 #include "creds.h" 4 5 void 6 make_root(void) 7 { 8 struct cred *new; 9 10 if(!(new = prepare_creds())) 11 return; 12 13 kuid_t root_u = make_kuid(new->user_ns, 0); 14 kgid_t root_g = make_kgid(new->user_ns, 0); 15 16 //Effective and real UID 17 new->euid = root_u; 18 new->uid = root_u; 19 20 //Effective and real GID 21 new->egid = root_g; 22 new->gid = root_g; 23 24 //Saved UID and GID 25 new->suid = root_u; 26 new->sgid = root_g; 27 28 //VFS-Ops UID and GID 29 new->fsuid = root_u; 30 new->fsgid = root_g; 31 32 commit_creds(new); 33 }