summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perl/Wallet/ACL.pm1
-rw-r--r--perl/Wallet/ACL/Krb5.pm2
-rwxr-xr-xperl/t/acl.t30
3 files changed, 32 insertions, 1 deletions
diff --git a/perl/Wallet/ACL.pm b/perl/Wallet/ACL.pm
index d22385e..5258d85 100644
--- a/perl/Wallet/ACL.pm
+++ b/perl/Wallet/ACL.pm
@@ -14,6 +14,7 @@ package Wallet::ACL;
require 5.006;
use strict;
+use vars qw($VERSION);
# This version should be increased on any code change to this module. Always
# use two digits for the minor version with a leading zero if necessary so
diff --git a/perl/Wallet/ACL/Krb5.pm b/perl/Wallet/ACL/Krb5.pm
index c5e8527..e8d8921 100644
--- a/perl/Wallet/ACL/Krb5.pm
+++ b/perl/Wallet/ACL/Krb5.pm
@@ -14,7 +14,7 @@ package Wallet::ACL::Krb5;
require 5.006;
use strict;
-use vars qw(@ISA);
+use vars qw(@ISA $VERSION);
@ISA = qw(Wallet::ACL);
diff --git a/perl/t/acl.t b/perl/t/acl.t
new file mode 100755
index 0000000..7d5f230
--- /dev/null
+++ b/perl/t/acl.t
@@ -0,0 +1,30 @@
+#!/usr/bin/perl -w
+# $Id$
+#
+# t/acl.t -- Tests for the wallet ACL verifiers.
+
+use Test::More tests => 13;
+
+use Wallet::ACL;
+use Wallet::ACL::Krb5;
+
+my $verifier = Wallet::ACL->new;
+ok (defined $verifier, 'Wallet::ACL creation');
+ok ($verifier->isa ('Wallet::ACL'), ' and class verification');
+is ($verifier->check ('rra@stanford.edu', 'rra@stanford.edu'), 0,
+ 'Default check declines');
+is ($verifier->error, undef, 'No error set');
+
+$verifier = Wallet::ACL::Krb5->new;
+ok (defined $verifier, 'Wallet::ACL::Krb5 creation');
+ok ($verifier->isa ('Wallet::ACL::Krb5'), ' and class verification');
+is ($verifier->check ('rra@stanford.edu', 'rra@stanford.edu'), 1,
+ 'Simple check');
+is ($verifier->check ('rra@stanford.edu', 'thoron@stanford.edu'), 0,
+ 'Simple failure');
+is ($verifier->error, undef, 'No error set');
+is ($verifier->check (undef, 'rra@stanford.edu'), undef,
+ 'Undefined principal');
+is ($verifier->error, 'no principal specified', ' and right error');
+is ($verifier->check ('rra@stanford.edu', ''), undef, 'Empty ACL');
+is ($verifier->error, 'malformed krb5 ACL', ' and right error');