uid.c revision 2f7d020e2258b8565c3809cfe2dd76668a1c433d
1#include "defs.h" 2 3#include <asm/posix_types.h> 4 5int 6sys_getuid(struct tcb *tcp) 7{ 8 if (exiting(tcp)) 9 tcp->u_rval = (uid_t) tcp->u_rval; 10 return RVAL_UDECIMAL; 11} 12 13int 14sys_setfsuid(struct tcb *tcp) 15{ 16 if (entering(tcp)) 17 tprintf("%u", (uid_t) tcp->u_arg[0]); 18 else 19 tcp->u_rval = (uid_t) tcp->u_rval; 20 return RVAL_UDECIMAL; 21} 22 23int 24sys_setuid(struct tcb *tcp) 25{ 26 if (entering(tcp)) { 27 tprintf("%u", (uid_t) tcp->u_arg[0]); 28 } 29 return 0; 30} 31 32int 33sys_getresuid(struct tcb *tcp) 34{ 35 if (exiting(tcp)) { 36 __kernel_uid_t uid; 37 if (syserror(tcp)) 38 tprintf("%#lx, %#lx, %#lx", tcp->u_arg[0], 39 tcp->u_arg[1], tcp->u_arg[2]); 40 else { 41 if (umove(tcp, tcp->u_arg[0], &uid) < 0) 42 tprintf("%#lx, ", tcp->u_arg[0]); 43 else 44 tprintf("[%lu], ", (unsigned long) uid); 45 if (umove(tcp, tcp->u_arg[1], &uid) < 0) 46 tprintf("%#lx, ", tcp->u_arg[1]); 47 else 48 tprintf("[%lu], ", (unsigned long) uid); 49 if (umove(tcp, tcp->u_arg[2], &uid) < 0) 50 tprintf("%#lx", tcp->u_arg[2]); 51 else 52 tprintf("[%lu]", (unsigned long) uid); 53 } 54 } 55 return 0; 56} 57 58int 59sys_setreuid(struct tcb *tcp) 60{ 61 if (entering(tcp)) { 62 printuid("", tcp->u_arg[0]); 63 printuid(", ", tcp->u_arg[1]); 64 } 65 return 0; 66} 67 68int 69sys_setresuid(struct tcb *tcp) 70{ 71 if (entering(tcp)) { 72 printuid("", tcp->u_arg[0]); 73 printuid(", ", tcp->u_arg[1]); 74 printuid(", ", tcp->u_arg[2]); 75 } 76 return 0; 77} 78 79int 80sys_chown(struct tcb *tcp) 81{ 82 if (entering(tcp)) { 83 printpath(tcp, tcp->u_arg[0]); 84 printuid(", ", tcp->u_arg[1]); 85 printuid(", ", tcp->u_arg[2]); 86 } 87 return 0; 88} 89 90int 91sys_fchown(struct tcb *tcp) 92{ 93 if (entering(tcp)) { 94 printfd(tcp, tcp->u_arg[0]); 95 printuid(", ", tcp->u_arg[1]); 96 printuid(", ", tcp->u_arg[2]); 97 } 98 return 0; 99} 100 101void 102printuid(const char *text, const unsigned int uid) 103{ 104 if ((unsigned int) -1 == uid) 105 tprintf("%s-1", text); 106 else 107 tprintf("%s%u", text, uid); 108} 109