diff options
author | Russ Allbery <rra@stanford.edu> | 2008-02-12 00:07:59 +0000 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2008-02-12 00:07:59 +0000 |
commit | 247366355b63b3f6804d591dde9d5b48895a8fdf (patch) | |
tree | 5598f9b6c530ba048b361038cb786ca6ad25177f | |
parent | ed075220bbd6515c713a5e53af00d6db66cd1c7c (diff) |
Move getcreds into the utility library as well.
-rwxr-xr-x | perl/t/keytab.t | 16 | ||||
-rw-r--r-- | perl/t/lib/Util.pm | 22 | ||||
-rwxr-xr-x | perl/t/verifier.t | 16 |
3 files changed, 21 insertions, 33 deletions
diff --git a/perl/t/keytab.t b/perl/t/keytab.t index 21a53c6..c1348d4 100755 --- a/perl/t/keytab.t +++ b/perl/t/keytab.t @@ -75,22 +75,6 @@ sub destroy { system_quiet ($Wallet::Config::KEYTAB_KADMIN, @args); } -# Given a keytab file, try authenticating with kinit. -sub getcreds { - my ($file, $principal) = @_; - my @commands = ( - "kinit -k -t $file $principal 2>&1 >/dev/null </dev/null", - "kinit -t $file $principal 2>&1 >/dev/null </dev/null", - "kinit -k -K $file $principal 2>&1 >/dev/null </dev/null", - ); - for my $command (@commands) { - if (system ($command) == 0) { - return 1; - } - } - return 0; -} - # Check whether a principal exists. sub created { my ($principal) = @_; diff --git a/perl/t/lib/Util.pm b/perl/t/lib/Util.pm index 8aec1aa..481b7d9 100644 --- a/perl/t/lib/Util.pm +++ b/perl/t/lib/Util.pm @@ -21,7 +21,7 @@ $VERSION = '0.02'; use Exporter (); @ISA = qw(Exporter); -@EXPORT = qw(contents db_setup remctld_spawn remctld_stop); +@EXPORT = qw(contents db_setup getcreds remctld_spawn remctld_stop); ############################################################################## # General utility functions @@ -67,6 +67,26 @@ sub db_setup { } ############################################################################## +# Local ticket cache +############################################################################## + +# Given a keytab file and a principal, try authenticating with kinit. +sub getcreds { + my ($file, $principal) = @_; + my @commands = ( + "kinit -k -t $file $principal >/dev/null 2>&1 </dev/null", + "kinit -t $file $principal >/dev/null 2>&1 </dev/null", + "kinit -k -K $file $principal >/dev/null 2>&1 </dev/null", + ); + for my $command (@commands) { + if (system ($command) == 0) { + return 1; + } + } + return 0; +} + +############################################################################## # remctld handling ############################################################################## diff --git a/perl/t/verifier.t b/perl/t/verifier.t index c1ead6f..96e641d 100755 --- a/perl/t/verifier.t +++ b/perl/t/verifier.t @@ -19,22 +19,6 @@ use Wallet::Config; use lib 't/lib'; use Util; -# Given a keytab file, try authenticating with kinit. -sub getcreds { - my ($file, $principal) = @_; - my @commands = ( - "kinit -k -t $file $principal 2>&1 >/dev/null </dev/null", - "kinit -t $file $principal 2>&1 >/dev/null </dev/null", - "kinit -k -K $file $principal 2>&1 >/dev/null </dev/null", - ); - for my $command (@commands) { - if (system ($command) == 0) { - return 1; - } - } - return 0; -} - my $verifier = Wallet::ACL::Base->new; ok (defined $verifier, 'Wallet::ACL::Base creation'); ok ($verifier->isa ('Wallet::ACL::Base'), ' and class verification'); |