From 76df85d4061fd6f2c6498f2a772a84c484ca2aa0 Mon Sep 17 00:00:00 2001 From: provos Date: Wed, 26 Mar 2003 04:14:16 +0000 Subject: [PATCH] very simple regression test for systrace; okay atatat@ --- regress/bin/systrace/Makefile | 5 +++++ regress/bin/systrace/id/Makefile | 8 ++++++++ regress/bin/systrace/id/id.policy | 26 ++++++++++++++++++++++++++ regress/bin/systrace/id/id.sh | 17 +++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 regress/bin/systrace/Makefile create mode 100644 regress/bin/systrace/id/Makefile create mode 100644 regress/bin/systrace/id/id.policy create mode 100644 regress/bin/systrace/id/id.sh diff --git a/regress/bin/systrace/Makefile b/regress/bin/systrace/Makefile new file mode 100644 index 000000000000..f51dc1e02c12 --- /dev/null +++ b/regress/bin/systrace/Makefile @@ -0,0 +1,5 @@ +# $NetBSD: Makefile,v 1.1.1.1 2003/03/26 04:14:16 provos Exp $ + +SUBDIR+= id + +.include diff --git a/regress/bin/systrace/id/Makefile b/regress/bin/systrace/id/Makefile new file mode 100644 index 000000000000..c51f36f70097 --- /dev/null +++ b/regress/bin/systrace/id/Makefile @@ -0,0 +1,8 @@ +# $NetBSD: Makefile,v 1.1.1.1 2003/03/26 04:14:16 provos Exp $ + +NOMAN= # defined + +regress: + @ksh ${.CURDIR}/id.sh ${.CURDIR}/id.policy + +.include diff --git a/regress/bin/systrace/id/id.policy b/regress/bin/systrace/id/id.policy new file mode 100644 index 000000000000..826c53dc5194 --- /dev/null +++ b/regress/bin/systrace/id/id.policy @@ -0,0 +1,26 @@ +Policy: /usr/bin/id, Emulation: netbsd + netbsd-mmap: permit + netbsd-fsread: filename eq "/etc/ld.so.conf" then permit + netbsd-__fstat13: permit + netbsd-close: permit + netbsd-munmap: permit + netbsd-fsread: filename match "/usr/pkg/lib/libc.so.*" then permit + netbsd-fsread: filename match "/lib/libc.so.*" then permit + netbsd-__sysctl: permit + netbsd-fsread: filename eq "/etc/malloc.conf" then permit + netbsd-break: permit + netbsd-getuid: permit + netbsd-ioctl: permit + netbsd-fsread: filename eq "/etc/nsswitch.conf" then permit + netbsd-read: permit + netbsd-geteuid: permit + netbsd-fsread: filename eq "/etc/pwd.db" then permit + netbsd-fcntl: permit + netbsd-pread: permit + netbsd-getgid: permit + netbsd-fsread: filename eq "/etc/group" then permit + netbsd-getegid: permit + netbsd-getgroups: permit + netbsd-write: permit + netbsd-exit: permit + diff --git a/regress/bin/systrace/id/id.sh b/regress/bin/systrace/id/id.sh new file mode 100644 index 000000000000..d840a5dfc20a --- /dev/null +++ b/regress/bin/systrace/id/id.sh @@ -0,0 +1,17 @@ +#!/bin/ksh +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