From 247366355b63b3f6804d591dde9d5b48895a8fdf Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 12 Feb 2008 00:07:59 +0000 Subject: Move getcreds into the utility library as well. --- perl/t/lib/Util.pm | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'perl/t/lib') 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 @@ -66,6 +66,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 2>&1 /dev/null 2>&1