aboutsummaryrefslogtreecommitdiff
path: root/perl/t/data/acl-command
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2016-01-17 19:43:10 -0800
committerRuss Allbery <eagle@eyrie.org>2016-01-17 19:43:10 -0800
commit4b3f858ef567c0d12511e7fea2a56f08f2729635 (patch)
treee1cad1c445669045b47264c8957878352c7adc03 /perl/t/data/acl-command
parent7856dc7cc5e16140c0084474fe54338f293bf77e (diff)
parent76f93739a8a933d98b87db9496861dae7de0ae1a (diff)
Imported Upstream version 1.3upstream/1.3
Diffstat (limited to 'perl/t/data/acl-command')
-rwxr-xr-xperl/t/data/acl-command47
1 files changed, 47 insertions, 0 deletions
diff --git a/perl/t/data/acl-command b/perl/t/data/acl-command
new file mode 100755
index 0000000..b7c3066
--- /dev/null
+++ b/perl/t/data/acl-command
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# An external ACL implementation. Checks that the first argument is
+# eagle@eyrie.org, the second argument is "test", and then returns success,
+# failure, or reports an error based on whether the second argument is
+# success, failure, or error.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2016 Russ Allbery <eagle@eyrie.org>
+#
+# See LICENSE for licensing terms.
+
+set -e
+
+# Check the initial principal argument.
+if [ "$1" != 'eagle@eyrie.org' ]; then
+ echo 'incorrect principal' >&2
+ exit 1
+fi
+
+# Check that the second and third arguments are file test (the test object).
+if [ "$2" != 'file' ]; then
+ echo 'incorrect second argument' >&2
+ exit 1
+fi
+if [ "$3" != 'test' ]; then
+ echo 'incorrect third argument' >&2
+ exit 1
+fi
+
+# Process the fourth argument.
+case $4 in
+ 'test success')
+ exit 0
+ ;;
+ 'test failure')
+ exit 1
+ ;;
+ 'test error')
+ echo 'some error' >&2
+ exit 1
+ ;;
+ *)
+ echo 'unknown fourth argument' >&2
+ exit 1
+ ;;
+esac