process.c: move get*uid and set*uid parsers to a separate file
* uid.c: New file. * Makefile.am (strace_SOURCES): Add it. * process.c (sys_getuid, sys_setfsuid, sys_setuid, sys_getresuid, sys_setreuid, sys_setresuid): Move to uid.c.
This commit is contained in:
parent
7211480fee
commit
e93ef1eb9d
@ -90,6 +90,7 @@ strace_SOURCES = \
|
||||
term.c \
|
||||
time.c \
|
||||
truncate.c \
|
||||
uid.c \
|
||||
umask.c \
|
||||
umount.c \
|
||||
uname.c \
|
||||
|
74
process.c
74
process.c
@ -71,8 +71,6 @@
|
||||
# define PTRACE_SETREGS PTRACE_SETREGS64
|
||||
#endif
|
||||
|
||||
#include <asm/posix_types.h>
|
||||
|
||||
#if defined(IA64)
|
||||
# include <asm/ptrace_offsets.h>
|
||||
# include <asm/rse.h>
|
||||
@ -268,78 +266,6 @@ sys_fork(struct tcb *tcp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sys_getuid(struct tcb *tcp)
|
||||
{
|
||||
if (exiting(tcp))
|
||||
tcp->u_rval = (uid_t) tcp->u_rval;
|
||||
return RVAL_UDECIMAL;
|
||||
}
|
||||
|
||||
int sys_setfsuid(struct tcb *tcp)
|
||||
{
|
||||
if (entering(tcp))
|
||||
tprintf("%u", (uid_t) tcp->u_arg[0]);
|
||||
else
|
||||
tcp->u_rval = (uid_t) tcp->u_rval;
|
||||
return RVAL_UDECIMAL;
|
||||
}
|
||||
|
||||
int
|
||||
sys_setuid(struct tcb *tcp)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
tprintf("%u", (uid_t) tcp->u_arg[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sys_getresuid(struct tcb *tcp)
|
||||
{
|
||||
if (exiting(tcp)) {
|
||||
__kernel_uid_t uid;
|
||||
if (syserror(tcp))
|
||||
tprintf("%#lx, %#lx, %#lx", tcp->u_arg[0],
|
||||
tcp->u_arg[1], tcp->u_arg[2]);
|
||||
else {
|
||||
if (umove(tcp, tcp->u_arg[0], &uid) < 0)
|
||||
tprintf("%#lx, ", tcp->u_arg[0]);
|
||||
else
|
||||
tprintf("[%lu], ", (unsigned long) uid);
|
||||
if (umove(tcp, tcp->u_arg[1], &uid) < 0)
|
||||
tprintf("%#lx, ", tcp->u_arg[1]);
|
||||
else
|
||||
tprintf("[%lu], ", (unsigned long) uid);
|
||||
if (umove(tcp, tcp->u_arg[2], &uid) < 0)
|
||||
tprintf("%#lx", tcp->u_arg[2]);
|
||||
else
|
||||
tprintf("[%lu]", (unsigned long) uid);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sys_setreuid(struct tcb *tcp)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
printuid("", tcp->u_arg[0]);
|
||||
printuid(", ", tcp->u_arg[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sys_setresuid(struct tcb *tcp)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
printuid("", tcp->u_arg[0]);
|
||||
printuid(", ", tcp->u_arg[1]);
|
||||
printuid(", ", tcp->u_arg[2]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "xlat/ptrace_cmds.h"
|
||||
#include "xlat/ptrace_setoptions_flags.h"
|
||||
#include "xlat/nt_descriptor_types.h"
|
||||
|
77
uid.c
Normal file
77
uid.c
Normal file
@ -0,0 +1,77 @@
|
||||
#include "defs.h"
|
||||
|
||||
#include <asm/posix_types.h>
|
||||
|
||||
int
|
||||
sys_getuid(struct tcb *tcp)
|
||||
{
|
||||
if (exiting(tcp))
|
||||
tcp->u_rval = (uid_t) tcp->u_rval;
|
||||
return RVAL_UDECIMAL;
|
||||
}
|
||||
|
||||
int
|
||||
sys_setfsuid(struct tcb *tcp)
|
||||
{
|
||||
if (entering(tcp))
|
||||
tprintf("%u", (uid_t) tcp->u_arg[0]);
|
||||
else
|
||||
tcp->u_rval = (uid_t) tcp->u_rval;
|
||||
return RVAL_UDECIMAL;
|
||||
}
|
||||
|
||||
int
|
||||
sys_setuid(struct tcb *tcp)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
tprintf("%u", (uid_t) tcp->u_arg[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sys_getresuid(struct tcb *tcp)
|
||||
{
|
||||
if (exiting(tcp)) {
|
||||
__kernel_uid_t uid;
|
||||
if (syserror(tcp))
|
||||
tprintf("%#lx, %#lx, %#lx", tcp->u_arg[0],
|
||||
tcp->u_arg[1], tcp->u_arg[2]);
|
||||
else {
|
||||
if (umove(tcp, tcp->u_arg[0], &uid) < 0)
|
||||
tprintf("%#lx, ", tcp->u_arg[0]);
|
||||
else
|
||||
tprintf("[%lu], ", (unsigned long) uid);
|
||||
if (umove(tcp, tcp->u_arg[1], &uid) < 0)
|
||||
tprintf("%#lx, ", tcp->u_arg[1]);
|
||||
else
|
||||
tprintf("[%lu], ", (unsigned long) uid);
|
||||
if (umove(tcp, tcp->u_arg[2], &uid) < 0)
|
||||
tprintf("%#lx", tcp->u_arg[2]);
|
||||
else
|
||||
tprintf("[%lu]", (unsigned long) uid);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sys_setreuid(struct tcb *tcp)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
printuid("", tcp->u_arg[0]);
|
||||
printuid(", ", tcp->u_arg[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sys_setresuid(struct tcb *tcp)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
printuid("", tcp->u_arg[0]);
|
||||
printuid(", ", tcp->u_arg[1]);
|
||||
printuid(", ", tcp->u_arg[2]);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user