handle svr4 procpriv call

This commit is contained in:
John Hughes 2002-05-17 11:37:50 +00:00
parent ccef63782c
commit c61eb3dce2
4 changed files with 144 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2002-05-17 John Hughes <john@calva.com>
* process.c, svr4/dummy.h, svr4/syscall.h: decode arguments
to procpriv syscall.
2002-05-01 Wichert Akkerman <wichert@deephackmode.org>
* configure.in, defs.h, process.c, sock.c, syscall.c, util.c: merge

138
process.c
View File

@ -1107,6 +1107,144 @@ struct tcb *tcp;
return 0;
}
#if UNIXWARE >= 2
#include <sys/privilege.h>
static struct xlat procpriv_cmds [] = {
{ SETPRV, "SETPRV" },
{ CLRPRV, "CLRPRV" },
{ PUTPRV, "PUTPRV" },
{ GETPRV, "GETPRV" },
{ CNTPRV, "CNTPRV" },
{ 0, NULL },
};
static struct xlat procpriv_priv [] = {
{ P_OWNER, "P_OWNER" },
{ P_AUDIT, "P_AUDIT" },
{ P_COMPAT, "P_COMPAT" },
{ P_DACREAD, "P_DACREAD" },
{ P_DACWRITE, "P_DACWRITE" },
{ P_DEV, "P_DEV" },
{ P_FILESYS, "P_FILESYS" },
{ P_MACREAD, "P_MACREAD" },
{ P_MACWRITE, "P_MACWRITE" },
{ P_MOUNT, "P_MOUNT" },
{ P_MULTIDIR, "P_MULTIDIR" },
{ P_SETPLEVEL, "P_SETPLEVEL" },
{ P_SETSPRIV, "P_SETSPRIV" },
{ P_SETUID, "P_SETUID" },
{ P_SYSOPS, "P_SYSOPS" },
{ P_SETUPRIV, "P_SETUPRIV" },
{ P_DRIVER, "P_DRIVER" },
{ P_RTIME, "P_RTIME" },
{ P_MACUPGRADE, "P_MACUPGRADE" },
{ P_FSYSRANGE, "P_FSYSRANGE" },
{ P_SETFLEVEL, "P_SETFLEVEL" },
{ P_AUDITWR, "P_AUDITWR" },
{ P_TSHAR, "P_TSHAR" },
{ P_PLOCK, "P_PLOCK" },
{ P_CORE, "P_CORE" },
{ P_LOADMOD, "P_LOADMOD" },
{ P_BIND, "P_BIND" },
{ P_ALLPRIVS, "P_ALLPRIVS" },
{ 0, NULL },
};
static struct xlat procpriv_type [] = {
{ PS_FIX, "PS_FIX" },
{ PS_INH, "PS_INH" },
{ PS_MAX, "PS_MAX" },
{ PS_WKG, "PS_WKG" },
{ 0, NULL },
};
static void
printpriv(tcp, addr, len, opt)
struct tcb *tcp;
long addr;
int len;
struct xlat *opt;
{
priv_t buf [128];
int max = verbose (tcp) ? sizeof buf / sizeof buf [0] : 10;
int dots = len > max;
int i;
if (len > max) len = max;
if (len <= 0 ||
umoven (tcp, addr, len * sizeof buf[0], (char *) buf) < 0)
{
tprintf ("%#lx", addr);
return;
}
tprintf ("[");
for (i = 0; i < len; ++i) {
char *t, *p;
if (i) tprintf (", ");
if ((t = xlookup (procpriv_type, buf [i] & PS_TYPE)) &&
(p = xlookup (procpriv_priv, buf [i] & ~PS_TYPE)))
{
tprintf ("%s|%s", t, p);
}
else {
tprintf ("%#lx", buf [i]);
}
}
if (dots) tprintf (" ...");
tprintf ("]");
}
int
sys_procpriv(tcp)
struct tcb *tcp;
{
if (entering(tcp)) {
printxval(procpriv_cmds, tcp->u_arg[0], "???PRV");
switch (tcp->u_arg[0]) {
case CNTPRV:
tprintf(", %#lx, %ld", tcp->u_arg[1], tcp->u_arg[2]);
break;
case GETPRV:
break;
default:
tprintf (", ");
printpriv (tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf (", %ld", tcp->u_arg[2]);
}
}
else if (tcp->u_arg[0] == GETPRV) {
if (syserror (tcp)) {
tprintf(", %#lx, %ld", tcp->u_arg[1], tcp->u_arg[2]);
}
else {
tprintf (", ");
printpriv (tcp, tcp->u_arg[1], tcp->u_rval);
tprintf (", %ld", tcp->u_arg[2]);
}
}
return 0;
}
#endif
void
fake_execve(tcp, program, argv, envp)
struct tcb *tcp;

View File

@ -143,7 +143,6 @@
#define sys_keyctl printargs
#define sys_secsys printargs
#define sys_filepriv printargs
#define sys_procpriv printargs
#define sys_devstat printargs
#define sys_fdevstat printargs
#define sys_flvlfile printargs

View File

@ -309,6 +309,7 @@ extern int sys_sigwait();
extern int sys_truncate();
extern int sys_ftruncate();
extern int sys_getksym ();
extern int sys_procpriv();
#endif
#if UNIXWARE >= 7
extern int sys_lseek64 ();