summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2002-07-13 08:54:11 +0000
committerNiels Provos <provos@cvs.openbsd.org>2002-07-13 08:54:11 +0000
commit122807295cadb8bee88b75f367508af8f5ce2664 (patch)
treea6ec961cd46bc5169474bceb036a2b6ff71ade0a
parent52b2037138ab4168bd4660e3a8028e811e23fb31 (diff)
uname translation
-rw-r--r--bin/systrace/register.c6
-rw-r--r--bin/systrace/systrace-translate.c20
-rw-r--r--bin/systrace/systrace.h3
3 files changed, 26 insertions, 3 deletions
diff --git a/bin/systrace/register.c b/bin/systrace/register.c
index bc07ffc41f6..7ab397c0576 100644
--- a/bin/systrace/register.c
+++ b/bin/systrace/register.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: register.c,v 1.2 2002/07/12 12:26:29 provos Exp $ */
+/* $OpenBSD: register.c,v 1.3 2002/07/13 08:54:10 provos Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -111,6 +111,8 @@ systrace_initcb(void)
X(intercept_register_sccb("native", "chdir", trans_cb, NULL));
intercept_register_transfn("native", "chdir", 0);
+ X(intercept_register_sccb("native", "chroot", trans_cb, NULL));
+ intercept_register_transfn("native", "chroot", 0);
X(intercept_register_sccb("native", "access", trans_cb, NULL));
tl = intercept_register_transfn("native", "access", 0);
alias = systrace_new_alias("native", "access", "native", "fsread");
@@ -134,8 +136,10 @@ systrace_initcb(void)
X(intercept_register_sccb("native", "setuid", trans_cb, NULL));
intercept_register_translation("native", "setuid", 0, &uidt);
+ intercept_register_translation("native", "setuid", 0, &uname);
X(intercept_register_sccb("native", "seteuid", trans_cb, NULL));
intercept_register_translation("native", "seteuid", 0, &uidt);
+ intercept_register_translation("native", "seteuid", 0, &uname);
X(intercept_register_sccb("native", "setgid", trans_cb, NULL));
intercept_register_translation("native", "setgid", 0, &gidt);
X(intercept_register_sccb("native", "setegid", trans_cb, NULL));
diff --git a/bin/systrace/systrace-translate.c b/bin/systrace/systrace-translate.c
index 7917e20f11c..afde4e3189b 100644
--- a/bin/systrace/systrace-translate.c
+++ b/bin/systrace/systrace-translate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: systrace-translate.c,v 1.3 2002/07/09 15:22:27 provos Exp $ */
+/* $OpenBSD: systrace-translate.c,v 1.4 2002/07/13 08:54:10 provos Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -37,6 +37,7 @@
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
+#include <pwd.h>
#include <err.h>
#include "../../sys/compat/linux/linux_types.h"
@@ -158,6 +159,18 @@ print_number(char *buf, size_t buflen, struct intercept_translate *tl)
return (0);
}
+int
+print_uname(char *buf, size_t buflen, struct intercept_translate *tl)
+{
+ struct passwd *pw;
+ uid_t uid = (uid_t)tl->trans_addr;
+
+ pw = getpwuid(uid);
+ snprintf(buf, buflen, "%s", pw != NULL ? pw->pw_name : "<unknown>");
+
+ return (0);
+}
+
struct intercept_translate oflags = {
"oflags",
NULL, print_oflags,
@@ -178,6 +191,11 @@ struct intercept_translate uidt = {
NULL, print_number,
};
+struct intercept_translate uname = {
+ "uname",
+ NULL, print_uname,
+};
+
struct intercept_translate gidt = {
"gid",
NULL, print_number,
diff --git a/bin/systrace/systrace.h b/bin/systrace/systrace.h
index 175f84a28c9..9112118b827 100644
--- a/bin/systrace/systrace.h
+++ b/bin/systrace/systrace.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: systrace.h,v 1.7 2002/07/11 12:57:41 provos Exp $ */
+/* $OpenBSD: systrace.h,v 1.8 2002/07/13 08:54:10 provos Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -170,6 +170,7 @@ extern struct intercept_translate oflags;
extern struct intercept_translate modeflags;
extern struct intercept_translate fdt;
extern struct intercept_translate uidt;
+extern struct intercept_translate uname;
extern struct intercept_translate gidt;
extern struct intercept_translate linux_oflags;