Dmitry V. Levin | e93ef1e | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 1 | #include "defs.h" |
| 2 | |
| 3 | #include <asm/posix_types.h> |
| 4 | |
| 5 | int |
| 6 | sys_getuid(struct tcb *tcp) |
| 7 | { |
| 8 | if (exiting(tcp)) |
| 9 | tcp->u_rval = (uid_t) tcp->u_rval; |
| 10 | return RVAL_UDECIMAL; |
| 11 | } |
| 12 | |
| 13 | int |
| 14 | sys_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 | |
| 23 | int |
| 24 | sys_setuid(struct tcb *tcp) |
| 25 | { |
| 26 | if (entering(tcp)) { |
| 27 | tprintf("%u", (uid_t) tcp->u_arg[0]); |
| 28 | } |
| 29 | return 0; |
| 30 | } |
| 31 | |
| 32 | int |
| 33 | sys_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 | |
| 58 | int |
| 59 | sys_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 | |
| 68 | int |
| 69 | sys_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 | } |
Dmitry V. Levin | 25ebe46 | 2014-12-13 16:02:22 +0000 | [diff] [blame^] | 78 | |
| 79 | void |
| 80 | printuid(const char *text, const unsigned int uid) |
| 81 | { |
| 82 | if ((unsigned int) -1 == uid) |
| 83 | tprintf("%s-1", text); |
| 84 | else |
| 85 | tprintf("%s%u", text, uid); |
| 86 | } |