From 236e209c3fefa0a56784ec3cd810a0bb5383b86d Mon Sep 17 00:00:00 2001 From: Jon Robertson Date: Wed, 16 Dec 2009 20:32:37 -0800 Subject: Provided path to call valid_principal directly valid_principal used to reside in Wallet::Object::Keytab, but was moved to the individual Wallet::Kadmin::* modules. This isn't necessary currently and may not ever be, but it's there just in case we do ever need to differentiate. To simplify testing, a way to still call it directly from Wallet::Object::Keytab has been added. --- perl/Wallet/Object/Keytab.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'perl/Wallet/Object/Keytab.pm') diff --git a/perl/Wallet/Object/Keytab.pm b/perl/Wallet/Object/Keytab.pm index 1732070..b1c9d6d 100644 --- a/perl/Wallet/Object/Keytab.pm +++ b/perl/Wallet/Object/Keytab.pm @@ -491,6 +491,13 @@ sub create { return $self; } +# Provides wrapper to individual Kadmin class's valid_principal. Here only +# to help expose for testing. +sub valid_principal { + my ($self, $principal) = @_; + return Wallet::Kadmin->valid_principal ($principal); +} + # Override destroy to delete the principal out of Kerberos as well. sub destroy { my ($self, $user, $host, $time) = @_; @@ -547,7 +554,12 @@ sub get { unlink $file; my @enctypes = $self->attr ('enctypes'); my $kadmin = $self->{kadmin}; - return if not $kadmin->ktadd ($self->{name}, $file, @enctypes); + my $retval = eval { $kadmin->ktadd ($self->{name}, $file, @enctypes) }; + if ($@) { + $self->error ($@); + return; + } + return unless $retval; local *KEYTAB; unless (open (KEYTAB, '<', $file)) { my $princ = $self->{name}; -- cgit v1.2.3