summaryrefslogtreecommitdiff
path: root/regress/bin
diff options
context:
space:
mode:
authorNikolay Sturm <sturm@cvs.openbsd.org>2004-01-15 17:14:44 +0000
committerNikolay Sturm <sturm@cvs.openbsd.org>2004-01-15 17:14:44 +0000
commit2b93432107f65f069490427a89fd1a5a735ffaba (patch)
tree1dc26c59d11e1ea9cd12163791dbfafcbad1e2ad /regress/bin
parentb9738c359196255c6c22a3c5294e81630376a050 (diff)
add simple systrace regresssion test
from provos@/NetBSD ok henning@
Diffstat (limited to 'regress/bin')
-rw-r--r--regress/bin/Makefile4
-rw-r--r--regress/bin/systrace/Makefile5
-rw-r--r--regress/bin/systrace/id/Makefile10
-rw-r--r--regress/bin/systrace/id/id.policy30
-rw-r--r--regress/bin/systrace/id/id.sh19
5 files changed, 66 insertions, 2 deletions
diff --git a/regress/bin/Makefile b/regress/bin/Makefile
index 4cc3797876d..814fa02c0e9 100644
--- a/regress/bin/Makefile
+++ b/regress/bin/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.3 2002/02/27 19:57:17 dhartmei Exp $
+# $OpenBSD: Makefile,v 1.4 2004/01/15 17:14:42 sturm Exp $
-SUBDIR+= md5 ksh
+SUBDIR+= md5 ksh systrace
install:
diff --git a/regress/bin/systrace/Makefile b/regress/bin/systrace/Makefile
new file mode 100644
index 00000000000..d62c5d984d9
--- /dev/null
+++ b/regress/bin/systrace/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2004/01/15 17:14:43 sturm Exp $
+
+SUBDIR+= id
+
+.include <bsd.subdir.mk>
diff --git a/regress/bin/systrace/id/Makefile b/regress/bin/systrace/id/Makefile
new file mode 100644
index 00000000000..9997759e76e
--- /dev/null
+++ b/regress/bin/systrace/id/Makefile
@@ -0,0 +1,10 @@
+# $OpenBSD: Makefile,v 1.1 2004/01/15 17:14:43 sturm Exp $
+
+REGRESS_TARGETS=id.sh
+
+id.sh:
+ @sh ${.CURDIR}/id.sh ${.CURDIR}/id.policy
+
+.PHONY: ${REGRESS_TARGETS}
+
+.include <bsd.regress.mk>
diff --git a/regress/bin/systrace/id/id.policy b/regress/bin/systrace/id/id.policy
new file mode 100644
index 00000000000..a3a6700b75f
--- /dev/null
+++ b/regress/bin/systrace/id/id.policy
@@ -0,0 +1,30 @@
+# $OpenBSD: id.policy,v 1.1 2004/01/15 17:14:43 sturm Exp $
+Policy: /usr/bin/id, Emulation: native
+ native-issetugid: permit
+ native-mprotect: permit
+ native-mmap: permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then permit
+ native-fstat: permit
+ native-close: permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then permit
+ native-read: permit
+ native-mquery: permit
+ native-munmap: permit
+ native-sigprocmask: permit
+ native-__sysctl: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-break: permit
+ native-getuid: permit
+ native-ioctl: permit
+ native-fsread: filename eq "/etc/spwd.db" then permit
+ native-fsread: filename eq "/etc/pwd.db" then permit
+ native-fcntl: permit
+ native-pread: permit
+ native-geteuid: permit
+ native-getgid: permit
+ native-fsread: filename eq "/etc/group" then permit
+ native-getegid: permit
+ native-getgroups: permit
+ native-write: permit
+ native-exit: permit
+
diff --git a/regress/bin/systrace/id/id.sh b/regress/bin/systrace/id/id.sh
new file mode 100644
index 00000000000..06e479be758
--- /dev/null
+++ b/regress/bin/systrace/id/id.sh
@@ -0,0 +1,19 @@
+#!/bin/ksh
+# $OpenBSD: id.sh,v 1.1 2004/01/15 17:14:43 sturm Exp $
+
+echo "/bin/systrace -f $1 -a /usr/bin/id"
+SYSTR_RES=`eval /bin/systrace -f $1 -a /usr/bin/id 2>/dev/null`
+NORM_RES=`/usr/bin/id`
+if [ -z "$SYSTR_RES" ] ; then
+ rm -f id.core
+ echo "Systrace of /usr/bin/id failed"
+ exit 1
+fi
+
+if [ "$NORM_RES" != "$SYSTR_RES" ] ; then
+ echo "Expected \"$NORM_RES\""
+ echo "Got \"$SYSTR_RES\""
+ exit 1
+fi
+
+exit 0