blob: 0a1a2eea721800dc6178f93199c8ebba49683e42 [file] [log] [blame]
Dmitry V. Levine93ef1e2014-12-11 19:25:02 +00001#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}
Dmitry V. Levin25ebe462014-12-13 16:02:22 +000078
79void
80printuid(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}