summaryrefslogtreecommitdiff
path: root/bin/systrace/policy.c
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2002-06-04 20:13:20 +0000
committerNiels Provos <provos@cvs.openbsd.org>2002-06-04 20:13:20 +0000
commitfd96d52ef86ed4ddd35308b053812515f45bb9d4 (patch)
tree09d31359d8b854f2a05287e11afea9de5f41d3ad /bin/systrace/policy.c
parentc8a0b1b77378512152d042659d38ce01c722fae9 (diff)
add flag to ignore user specified policies
Diffstat (limited to 'bin/systrace/policy.c')
-rw-r--r--bin/systrace/policy.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/bin/systrace/policy.c b/bin/systrace/policy.c
index 951623bad32..6fd08493356 100644
--- a/bin/systrace/policy.c
+++ b/bin/systrace/policy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: policy.c,v 1.3 2002/06/04 19:15:54 deraadt Exp $ */
+/* $OpenBSD: policy.c,v 1.4 2002/06/04 20:13:19 provos Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -260,12 +260,18 @@ systrace_policyfilename(char *dirname, char *name)
int
systrace_addpolicy(char *name)
{
- char *file;
+ char *file = NULL;
+ extern int userpolicy;
+
+ if (userpolicy) {
+ file = systrace_policyfilename(policydir, name);
+ /* Check if the user policy file exists */
+ if (file != NULL && access(file, R_OK) == -1)
+ file = NULL;
+ }
- if ((file = systrace_policyfilename(policydir, name)) == NULL)
- return (-1);
- /* Check if the user policy file exists */
- if (access(file, R_OK) == -1) {
+ /* Read global policy */
+ if (file == NULL) {
file = systrace_policyfilename(POLICY_PATH, name);
if (file == NULL)
return (-1);