#!/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. # # Copyright 2016 Russ Allbery # # SPDX-License-Identifier: MIT 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