diff options
| author | Russ Allbery <eagle@eyrie.org> | 2016-01-16 15:34:22 -0800 | 
|---|---|---|
| committer | Russ Allbery <eagle@eyrie.org> | 2016-01-16 15:35:49 -0800 | 
| commit | d2fde5b8330cab6bd6210ef99a628b1897676897 (patch) | |
| tree | 3bdb4383a95efc5c36b7fabe07ca7df0cb50f719 /perl/t | |
| parent | 44b98b0005effceb6fb5497b336fa86e05675e6f (diff) | |
Pass object type and name to external ACL verifiers
This requires changing the ACL verifier plumbing to pass object
type and name all the way through when verifying ACLs.  Hopefully
I caught everything.
Diffstat (limited to 'perl/t')
| -rwxr-xr-x | perl/t/data/acl-command | 20 | ||||
| -rwxr-xr-x | perl/t/verifier/external.t | 11 | 
2 files changed, 19 insertions, 12 deletions
| diff --git a/perl/t/data/acl-command b/perl/t/data/acl-command index e368118..b7c3066 100755 --- a/perl/t/data/acl-command +++ b/perl/t/data/acl-command @@ -18,26 +18,30 @@ if [ "$1" != 'eagle@eyrie.org' ]; then      exit 1  fi -# Check that the second argument is test. -if [ "$2" != 'test' ]; then +# 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 third argument. -case $3 in -    success) +# Process the fourth argument. +case $4 in +    'test success')          exit 0          ;; -    failure) +    'test failure')          exit 1          ;; -    error) +    'test error')          echo 'some error' >&2          exit 1          ;;      *) -        echo 'unknown third argument' >&2 +        echo 'unknown fourth argument' >&2          exit 1          ;;  esac diff --git a/perl/t/verifier/external.t b/perl/t/verifier/external.t index 3e7e776..d1438de 100755 --- a/perl/t/verifier/external.t +++ b/perl/t/verifier/external.t @@ -22,11 +22,14 @@ $Wallet::Config::EXTERNAL_COMMAND = 't/data/acl-command';  my $verifier = Wallet::ACL::External->new;  ok (defined $verifier, 'Wallet::ACL::External creation');  ok ($verifier->isa ('Wallet::ACL::External'), ' and class verification'); -is ($verifier->check ('eagle@eyrie.org', 'test success'), 1, 'Success'); -is ($verifier->check ('eagle@eyrie.org', 'test failure'), 0, 'Failure'); +is ($verifier->check ('eagle@eyrie.org', 'test success', 'file', 'test'), +    1, 'Success'); +is ($verifier->check ('eagle@eyrie.org', 'test failure', 'file', 'test'), +    0, 'Failure');  is ($verifier->error, undef, 'No error set'); -is ($verifier->check ('eagle@eyrie.org', 'test error'), undef, 'Error'); +is ($verifier->check ('eagle@eyrie.org', 'test error', 'file', 'test'), +    undef, 'Error');  is ($verifier->error, 'some error', ' and right error'); -is ($verifier->check (undef, 'eagle@eyrie.org'), undef, +is ($verifier->check (undef, 'eagle@eyrie.org', 'file', 'test'), undef,      'Undefined principal');  is ($verifier->error, 'no principal specified', ' and right error'); | 
