aboutsummaryrefslogtreecommitdiff
path: root/perl/t/data/acl-command
blob: e36811814f16696496708b1e6601ab190fea2e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/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 argument is test.
if [ "$2" != 'test' ]; then
    echo 'incorrect second argument' >&2
    exit 1
fi

# Process the third argument.
case $3 in
    success)
        exit 0
        ;;
    failure)
        exit 1
        ;;
    error)
        echo 'some error' >&2
        exit 1
        ;;
    *)
        echo 'unknown third argument' >&2
        exit 1
        ;;
esac