diff options
author | Russ Allbery <rra@stanford.edu> | 2010-02-18 16:34:24 -0800 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2010-02-18 16:34:24 -0800 |
commit | c5eb54321d631431d290fb27624bcbbf03626ff6 (patch) | |
tree | 3620d87847db52122ed12356cc7f237584aa936c /perl/Wallet | |
parent | 52ee9b9285f04551cfdcbde2b3b6293a706ca982 (diff) |
Refactor Wallet::Kadmin::Heimdal constructor
Remove the separate kadmin_client method by combining it with the
constructor, since that was the only place it was called.
Diffstat (limited to 'perl/Wallet')
-rw-r--r-- | perl/Wallet/Kadmin/Heimdal.pm | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/perl/Wallet/Kadmin/Heimdal.pm b/perl/Wallet/Kadmin/Heimdal.pm index 3047b2f..2d393e2 100644 --- a/perl/Wallet/Kadmin/Heimdal.pm +++ b/perl/Wallet/Kadmin/Heimdal.pm @@ -40,30 +40,6 @@ sub canonicalize_principal { } ############################################################################## -# kadmin Interaction -############################################################################## - -# Create a Heimdal::Kadm5 client object and return it. It should load -# configuration from Wallet::Config. -sub kadmin_client { - my ($self) = @_; - unless (defined ($Wallet::Config::KEYTAB_PRINCIPAL) - and defined ($Wallet::Config::KEYTAB_FILE) - and defined ($Wallet::Config::KEYTAB_REALM)) { - die "keytab object implementation not configured\n"; - } - my @options = (RaiseError => 1, - Principal => $Wallet::Config::KEYTAB_PRINCIPAL, - Realm => $Wallet::Config::KEYTAB_REALM, - Keytab => $Wallet::Config::KEYTAB_FILE); - if ($Wallet::Config::KEYTAB_HOST) { - push (@options, Server => $Wallet::Config::KEYTAB_HOST); - } - my $client = Heimdal::Kadm5::Client->new (@options); - return $client; -} - -############################################################################## # Public interfaces ############################################################################## @@ -198,14 +174,25 @@ sub delprinc { return 1; } -# Create a new Heimdal kadmin object. +# Create a new Wallet::Kadmin::Heimdal object and its underlying +# Heimdal::Kadm5 object. sub new { my ($class) = @_; - my $self = { - client => undef, - }; + unless (defined ($Wallet::Config::KEYTAB_PRINCIPAL) + and defined ($Wallet::Config::KEYTAB_FILE) + and defined ($Wallet::Config::KEYTAB_REALM)) { + die "keytab object implementation not configured\n"; + } + my @options = (RaiseError => 1, + Principal => $Wallet::Config::KEYTAB_PRINCIPAL, + Realm => $Wallet::Config::KEYTAB_REALM, + Keytab => $Wallet::Config::KEYTAB_FILE); + if ($Wallet::Config::KEYTAB_HOST) { + push (@options, Server => $Wallet::Config::KEYTAB_HOST); + } + my $client = Heimdal::Kadm5::Client->new (@options); + my $self = { client => $client }; bless ($self, $class); - $self->{client} = $self->kadmin_client; return $self; } |