aboutsummaryrefslogtreecommitdiff
path: root/perl/t/verifier/netdb.t
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2014-07-11 21:39:23 -0700
committerRuss Allbery <rra@stanford.edu>2014-07-11 22:39:05 -0700
commit1575d5c34a2c6235bbf6a5010f8a8c142fe47079 (patch)
tree29e51ed64f28a37530ec0b21fc24b6d20de1d6ca /perl/t/verifier/netdb.t
parentda0aba21779529d98436e42323fc12f702390969 (diff)
Switch to Module::Build for the Perl module
The wallet server now requires Perl 5.8 or later (instead of 5.006 in previous versions) and is now built with Module::Build instead of ExtUtils::MakeMaker. This should be transparent to anyone not working with the source code, since Perl 5.8 was released in 2002, but Module::Build is now required to build the wallet server. It is included in some versions of Perl, or can be installed separately from CPAN, distribution packages, or other sources. Also reorganize the test suite to use subdirectories. Change-Id: Id06120ba2bad1ebbfee3d8a48ca2f25869463165 Reviewed-on: https://gerrit.stanford.edu/1530 Reviewed-by: Russ Allbery <rra@stanford.edu> Tested-by: Russ Allbery <rra@stanford.edu>
Diffstat (limited to 'perl/t/verifier/netdb.t')
-rwxr-xr-xperl/t/verifier/netdb.t45
1 files changed, 45 insertions, 0 deletions
diff --git a/perl/t/verifier/netdb.t b/perl/t/verifier/netdb.t
new file mode 100755
index 0000000..d8fe561
--- /dev/null
+++ b/perl/t/verifier/netdb.t
@@ -0,0 +1,45 @@
+#!/usr/bin/perl -w
+#
+# Tests for the NetDB wallet ACL verifiers.
+#
+# This test can only be run by someone local to Stanford with appropriate
+# access to the NetDB role server and will be skipped in all other
+# environments.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2008, 2014
+# The Board of Trustees of the Leland Stanford Junior University
+#
+# See LICENSE for licensing terms.
+
+use Test::More tests => 5;
+
+use Wallet::ACL::NetDB;
+
+use lib 't/lib';
+use Util;
+
+my $netdb = 'netdb-node-roles-rc.stanford.edu';
+my $host = 'windlord.stanford.edu';
+my $user = 'rra@stanford.edu';
+
+# Determine the local principal.
+my $klist = `klist 2>&1` || '';
+SKIP: {
+ skip "tests useful only with Stanford Kerberos tickets", 5
+ unless ($klist =~ /^(Default p|\s+P)rincipal: \S+\@stanford\.edu$/m);
+
+ # Set up our configuration.
+ $Wallet::Config::NETDB_REALM = 'stanford.edu';
+ $Wallet::Config::NETDB_REMCTL_CACHE = $ENV{KRB5CCNAME};
+ $Wallet::Config::NETDB_REMCTL_HOST = $netdb;
+
+ # Finally, we can test.
+ $verifier = eval { Wallet::ACL::NetDB->new };
+ ok (defined $verifier, ' and now creation succeeds');
+ is ($@, q{}, ' with no errors');
+ ok ($verifier->isa ('Wallet::ACL::NetDB'), ' and returns the right class');
+ is ($verifier->check ($user, $host), 1, "Checking $host succeeds");
+ is ($verifier->check ('test-user@stanford.edu', $host), 0,
+ ' but fails with another user');
+}