summaryrefslogtreecommitdiff
path: root/perl/Wallet
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2010-01-19 22:48:01 -0800
committerRuss Allbery <rra@stanford.edu>2010-01-19 22:48:01 -0800
commitd684049761db4eb88cd936c530196ea89a524c07 (patch)
treea7be768921000e125b7b0989f75739509c3bde6b /perl/Wallet
parentb7aedd9b7290d51dc5e46c4b123cd5f0f080f9c7 (diff)
Coding style fixes for Perl wallet code
Strip trailing whitespace, convert tabs to spaces, add newlines to exceptions, and remove a few stray blank lines and a few other minor coding style oddities. Make the SQL style consistent.
Diffstat (limited to 'perl/Wallet')
-rw-r--r--perl/Wallet/Admin.pm105
-rw-r--r--perl/Wallet/Kadmin.pm10
-rw-r--r--perl/Wallet/Kadmin/Heimdal.pm102
-rw-r--r--perl/Wallet/Kadmin/MIT.pm32
-rw-r--r--perl/Wallet/Object/Base.pm12
-rw-r--r--perl/Wallet/Object/Keytab.pm13
6 files changed, 128 insertions, 146 deletions
diff --git a/perl/Wallet/Admin.pm b/perl/Wallet/Admin.pm
index 0e437ec..701c813 100644
--- a/perl/Wallet/Admin.pm
+++ b/perl/Wallet/Admin.pm
@@ -114,23 +114,22 @@ sub destroy {
# Reporting
##############################################################################
-# Given an ACL name, translate it to the ID for that ACL and return it.
+# Given an ACL name, translate it to the ID for that ACL and return it.
# Often this is unneeded and could be done with a join, but by doing it in a
-# separate step, we can give an error for the specific case of someone
+# separate step, we can give an error for the specific case of someone
# searching for a non-existant ACL.
sub acl_name_to_id {
my ($self, $acl) = @_;
my ($id);
eval {
- my $sql = 'select ac_id from acls where ac_name=?';
- my $sth = $self->{dbh}->prepare ($sql);
- $sth->execute ($acl);
- while (defined (my $row = $sth->fetchrow_hashref)) {
- $id = $row->{'ac_id'};
- }
- $self->{dbh}->commit;
+ my $sql = 'select ac_id from acls where ac_name = ?';
+ my $sth = $self->{dbh}->prepare ($sql);
+ $sth->execute ($acl);
+ while (defined (my $row = $sth->fetchrow_hashref)) {
+ $id = $row->{ac_id};
+ }
+ $self->{dbh}->commit;
};
-
if (!defined $id || $id !~ /^\d+$/) {
$self->error ("could not find the acl $acl");
return '';
@@ -155,7 +154,7 @@ sub list_objects_type {
return ($sql, $type);
}
-# Return the SQL statement and search field required to find all objects
+# Return the SQL statement and search field required to find all objects
# owned by a given ACL. If the requested owner is 'null', then we ignore
# this and do a different search for IS NULL. If the requested owner does
# not actually match any ACLs, set an error and return the empty string.
@@ -163,15 +162,15 @@ sub list_objects_owner {
my ($self, $owner) = @_;
my ($sth);
if ($owner =~ /^null$/i) {
- my $sql = 'select ob_type, ob_name from objects where ob_owner is null
+ my $sql = 'select ob_type, ob_name from objects where ob_owner is null
order by objects.ob_type, objects.ob_name';
- return ($sql);
+ return ($sql);
} else {
- my $id = $self->acl_name_to_id ($owner);
- return '' unless $id;
- my $sql = 'select ob_type, ob_name from objects where ob_owner=?
+ my $id = $self->acl_name_to_id ($owner);
+ return '' unless $id;
+ my $sql = 'select ob_type, ob_name from objects where ob_owner = ?
order by objects.ob_type, objects.ob_name';
- return ($sql, $id);
+ return ($sql, $id);
}
}
@@ -180,26 +179,24 @@ sub list_objects_owner {
sub list_objects_flag {
my ($self, $flag) = @_;
my $sql = 'select ob_type, ob_name from objects left join flags on
- (objects.ob_type=flags.fl_type AND objects.ob_name=flags.fl_name)
- where flags.fl_flag=? order by objects.ob_type, objects.ob_name';
+ (objects.ob_type = flags.fl_type and objects.ob_name = flags.fl_name)
+ where flags.fl_flag = ? order by objects.ob_type, objects.ob_name';
return ($sql, $flag);
}
-# Return the SQL statement and search field required to find all objects
+# Return the SQL statement and search field required to find all objects
# that a given ACL has any permissions on. This expands from
# list_objects_owner in that it will also match any records that have the ACL
# set for get, store, show, destroy, or flags. If the requested owner does
# not actually match any ACLs, set an error and return the empty string.
sub list_objects_acl {
my ($self, $acl) = @_;
-
my $id = $self->acl_name_to_id ($acl);
return '' unless $id;
-
- my $sql = 'select ob_type, ob_name from objects where
- ob_owner=? or ob_acl_get=? or ob_acl_store=? or ob_acl_show=? or
- ob_acl_destroy=? or ob_acl_flags=?
- order by objects.ob_type, objects.ob_name';
+ my $sql = 'select ob_type, ob_name from objects where ob_owner = ? or
+ ob_acl_get = ? or ob_acl_store = ? or ob_acl_show = ? or
+ ob_acl_destroy = ? or ob_acl_flags = ? order by objects.ob_type,
+ objects.ob_name';
return ($sql, $id, $id, $id, $id, $id, $id);
}
@@ -217,29 +214,29 @@ sub list_objects {
my $sql = '';
my @search = ();
if (!defined $type || $type eq '') {
- ($sql) = $self->list_objects_all ();
+ ($sql) = $self->list_objects_all ();
} else {
- if (@args != 1) {
- $self->error ("object searches require an argument to search");
- } elsif ($type eq 'type') {
- ($sql, @search) = $self->list_objects_type (@args);
- } elsif ($type eq 'owner') {
- ($sql, @search) = $self->list_objects_owner (@args);
- } elsif ($type eq 'flag') {
- ($sql, @search) = $self->list_objects_flag (@args);
- } elsif ($type eq 'acl') {
- ($sql, @search) = $self->list_objects_acl (@args);
- } else {
- $self->error ("do not know search type: $type");
- }
- return unless $sql;
+ if (@args != 1) {
+ $self->error ("object searches require an argument to search");
+ } elsif ($type eq 'type') {
+ ($sql, @search) = $self->list_objects_type (@args);
+ } elsif ($type eq 'owner') {
+ ($sql, @search) = $self->list_objects_owner (@args);
+ } elsif ($type eq 'flag') {
+ ($sql, @search) = $self->list_objects_flag (@args);
+ } elsif ($type eq 'acl') {
+ ($sql, @search) = $self->list_objects_acl (@args);
+ } else {
+ $self->error ("do not know search type: $type");
+ }
+ return unless $sql;
}
my @objects;
eval {
my $object;
- my $sth = $self->{dbh}->prepare ($sql);
- $sth->execute (@search);
+ my $sth = $self->{dbh}->prepare ($sql);
+ $sth->execute (@search);
while (defined ($object = $sth->fetchrow_arrayref)) {
push (@objects, [ @$object ]);
}
@@ -265,19 +262,19 @@ sub list_acls_all {
# the db.
sub list_acls_empty {
my ($self) = @_;
- my $sql = 'select ac_id, ac_name from acls left join acl_entries '
- .'on (acls.ac_id=acl_entries.ae_id) where ae_id is null;';
+ my $sql = 'select ac_id, ac_name from acls left join acl_entries
+ on (acls.ac_id = acl_entries.ae_id) where ae_id is null';
return ($sql);
}
# Returns the SQL statement and the field required to search the ACLs and
-# return only those entries which contain a entries with identifiers
+# return only those entries which contain a entries with identifiers
# matching a particular given string.
sub list_acls_entry {
my ($self, $type, $identifier) = @_;
- my $sql = 'select distinct ac_id, ac_name from acl_entries
- left join acls on (ae_id=ac_id) where ae_scheme=? and
- ae_identifier like ? order by ac_id';
+ my $sql = 'select distinct ac_id, ac_name from acl_entries left join acls
+ on (ae_id = ac_id) where ae_scheme = ? and ae_identifier like ? order
+ by ac_id';
$identifier = '%'.$identifier.'%';
return ($sql, $type, $identifier);
}
@@ -299,11 +296,11 @@ sub list_acls {
($sql) = $self->list_acls_all ();
} else {
if ($type eq 'entry') {
- if (@args == 0) {
- $self->error ("acl searches require an argument to search");
- } else {
- ($sql, @search) = $self->list_acls_entry (@args);
- }
+ if (@args == 0) {
+ $self->error ("acl searches require an argument to search");
+ } else {
+ ($sql, @search) = $self->list_acls_entry (@args);
+ }
} elsif ($type eq 'empty') {
($sql) = $self->list_acls_empty ();
} else {
diff --git a/perl/Wallet/Kadmin.pm b/perl/Wallet/Kadmin.pm
index 33c84a1..200136c 100644
--- a/perl/Wallet/Kadmin.pm
+++ b/perl/Wallet/Kadmin.pm
@@ -27,8 +27,8 @@ $VERSION = '0.02';
##############################################################################
# Validate a principal with a submodule's validator. We can also do this via
-# creating an object with new and then running valid_principal from that,
-# but there are times we might wish to run it without going through the
+# creating an object with new and then running valid_principal from that,
+# but there are times we might wish to run it without going through the
# object creation.
sub valid_principal {
my ($class, $principal) = @_;
@@ -48,10 +48,10 @@ sub new {
my ($class) = @_;
my ($kadmin);
if ($Wallet::Config::KEYTAB_KRBTYPE eq 'MIT') {
- require Wallet::Kadmin::MIT;
+ require Wallet::Kadmin::MIT;
$kadmin = Wallet::Kadmin::MIT->new ();
} elsif ($Wallet::Config::KEYTAB_KRBTYPE eq 'Heimdal') {
- require Wallet::Kadmin::Heimdal;
+ require Wallet::Kadmin::Heimdal;
$kadmin = Wallet::Kadmin::Heimdal->new ();
} else {
die "keytab krb server type not set to a valid value\n";
@@ -82,7 +82,7 @@ Wallet::Kadmin - Kadmin module wrapper for wallet keytabs
=head1 DESCRIPTION
Wallet::Kadmin is a wrapper to modules that provide an interface for keytab
-integration with the wallet. Each module is meant to interface with a
+integration with the wallet. Each module is meant to interface with a
specific type of Kerberos implementation, such as MIT Kerberos or Heimdal
Kerberos, and provide a standndard set of API calls used to interact with
that implementation's kadmind.
diff --git a/perl/Wallet/Kadmin/Heimdal.pm b/perl/Wallet/Kadmin/Heimdal.pm
index e4d175b..a8859bf 100644
--- a/perl/Wallet/Kadmin/Heimdal.pm
+++ b/perl/Wallet/Kadmin/Heimdal.pm
@@ -15,8 +15,7 @@ require 5.006;
use strict;
use vars qw($VERSION);
-use Heimdal::Kadm5 qw (KRB5_KDB_DISALLOW_ALL_TIX);
-
+use Heimdal::Kadm5 qw(KRB5_KDB_DISALLOW_ALL_TIX);
use Wallet::Config ();
# This version should be increased on any code change to this module. Always
@@ -37,7 +36,7 @@ sub valid_principal {
return scalar ($principal =~ m,^[\w-]+(/[\w_.-]+)?\z,);
}
-# Create a Heimdal::Kadm5 client object and return it. It should load
+# Create a Heimdal::Kadm5 client object and return it. It should load
# configuration from Wallet::Config.
sub kadmin_client {
unless (defined ($Wallet::Config::KEYTAB_PRINCIPAL)
@@ -45,15 +44,13 @@ sub kadmin_client {
and defined ($Wallet::Config::KEYTAB_REALM)) {
die "keytab object implementation not configured\n";
}
-
my $server = $Wallet::Config::KEYTAB_HOST || 'localhost';
- my $client = Heimdal::Kadm5::Client->new(
- RaiseErrors => 1,
- Server => $server,
- Principal => $Wallet::Config::KEYTAB_PRINCIPAL,
- Realm => $Wallet::Config::KEYTAB_REALM,
- Keytab => $Wallet::Config::KEYTAB_FILE,
- );
+ my @options = (RaiseErrors => 1,
+ Server => $server,
+ Principal => $Wallet::Config::KEYTAB_PRINCIPAL,
+ Realm => $Wallet::Config::KEYTAB_REALM,
+ Keytab => $Wallet::Config::KEYTAB_FILE);
+ my $client = Heimdal::Kadm5::Client->new (@options);
return $client;
}
@@ -70,16 +67,8 @@ sub exists {
$principal .= '@' . $Wallet::Config::KEYTAB_REALM;
}
my $kadmin = $self->{client};
- my $princdata = eval { $kadmin->getPrincipal ($principal) };
-
- if ($@) {
- die $@;
- return 0;
- } elsif ($princdata) {
- return 1;
- } else {
- return 0;
- }
+ my $princdata = $kadmin->getPrincipal ($principal);
+ return $princdata ? 1 : 0;
}
# Create a principal in Kerberos. Since this is only called by create, it
@@ -95,7 +84,7 @@ sub addprinc {
if ($Wallet::Config::KEYTAB_REALM) {
$principal .= '@' . $Wallet::Config::KEYTAB_REALM;
}
- die "error adding principal $principal: $@" if $@;
+ die "error adding principal $principal: $@\n" if $@;
return 1 if $exists;
# The way Heimdal::Kadm5 works, we create a principal object, create the
@@ -106,20 +95,19 @@ sub addprinc {
my $kadmin = $self->{client};
my $princdata = $kadmin->makePrincipal ($principal);
- # Disable the principal before creating, until we've randomized the
+ # Disable the principal before creating, until we've randomized the
# password.
my $attrs = $princdata->getAttributes;
$attrs |= KRB5_KDB_DISALLOW_ALL_TIX;
$princdata->setAttributes ($attrs);
my $password = 'inactive';
- my $retval = eval { $kadmin->createPrincipal ($princdata, $password, 0) };
- die "error adding principal $principal: $@" if $@;
- $retval = eval { $kadmin->randKeyPrincipal ($principal) };
- die "error adding principal $principal: $@" if $@;
- $retval = eval { $kadmin->enablePrincipal ($principal) };
+ eval {
+ $kadmin->createPrincipal ($princdata, $password, 0);
+ $kadmin->randKeyPrincipal ($principal);
+ $kadmin->enablePrincipal ($principal);
+ };
die "error adding principal $principal: $@" if $@;
-
return 1;
}
@@ -130,7 +118,7 @@ sub addprinc {
sub ktadd {
my ($self, $principal, $file, @enctypes) = @_;
unless ($self->valid_principal ($principal)) {
- die ("invalid principal name: $principal");
+ die "invalid principal name: $principal\n";
}
if ($Wallet::Config::KEYTAB_REALM) {
$principal .= '@' . $Wallet::Config::KEYTAB_REALM;
@@ -138,35 +126,35 @@ sub ktadd {
# The way Heimdal works, you can only remove enctypes from a principal,
# not add them back in. So we need to run randkeyPrincipal first each
- # time to restore all possible enctypes and then whittle them back down
+ # time to restore all possible enctypes and then whittle them back down
# to those we have been asked for this time.
my $kadmin = $self->{client};
eval { $kadmin->randKeyPrincipal ($principal) };
- die "error creating keytab for $principal: could not reinit enctypes: $@"
+ die "error creating keytab for $principal: could not reinit enctypes: $@\n"
if $@;
my $princdata = eval { $kadmin->getPrincipal ($principal) };
if ($@) {
- die "error creating keytab for $principal: $@";
+ die "error creating keytab for $principal: $@\n";
} elsif (!$princdata) {
- die "error creating keytab for $principal: principal does not exist";
+ die "error creating keytab for $principal: principal does not exist\n";
}
# Now actually remove any non-requested enctypes, if we requested any.
if (@enctypes) {
- my (%wanted);
- my $alltypes = $princdata->getKeytypes ();
- foreach (@enctypes) { $wanted{$_} = 1 }
- foreach my $key (@{$alltypes}) {
- my $keytype = ${$key}[0];
- next if exists $wanted{$keytype};
- eval { $princdata->delKeytypes ($keytype) };
- die "error removing keytype $keytype from the keytab: $@" if $@;
- }
- eval { $kadmin->modifyPrincipal ($princdata) };
+ my (%wanted);
+ my $alltypes = $princdata->getKeytypes ();
+ foreach (@enctypes) { $wanted{$_} = 1 }
+ foreach my $key (@{$alltypes}) {
+ my $keytype = ${$key}[0];
+ next if exists $wanted{$keytype};
+ eval { $princdata->delKeytypes ($keytype) };
+ die "error removing keytype $keytype from the keytab: $@\n" if $@;
+ }
+ eval { $kadmin->modifyPrincipal ($princdata) };
}
eval { $kadmin->extractKeytab ($princdata, $file) };
- die "error creating keytab for principal: $@" if $@;
+ die "error creating keytab for principal: $@\n" if $@;
return 1;
}
@@ -177,7 +165,7 @@ sub ktadd {
sub delprinc {
my ($self, $principal) = @_;
unless ($self->valid_principal ($principal)) {
- die ("invalid principal name: $principal");
+ die "invalid principal name: $principal\n";
}
my $exists = eval { $self->exists ($principal) };
die $@ if $@;
@@ -190,7 +178,7 @@ sub delprinc {
my $kadmin = $self->{client};
my $retval = eval { $kadmin->deletePrincipal ($principal) };
- die "error deleting $principal: $@" if $@;
+ die "error deleting $principal: $@\n" if $@;
return 1;
}
@@ -199,12 +187,12 @@ sub delprinc {
##############################################################################
# Create a new MIT kadmin object. Very empty for the moment, but later it
-# will probably fill out if we go to using a module rather than calling
+# will probably fill out if we go to using a module rather than calling
# kadmin directly.
sub new {
my ($class) = @_;
my $self = {
- client => kadmin_client (),
+ client => kadmin_client (),
};
bless ($self, $class);
return $self;
@@ -235,7 +223,7 @@ Wallet::Kadmin::MIT is an interface for keytab integration with the wallet,
specifically for using kadmin to create, delete, and add enctypes to keytabs.
It implments the wallet kadmin API and provides the necessary glue to MIT
Kerberos installs for each of these functions, while allowing the wallet
-to keep the details of what type of Kerberos installation is being used
+to keep the details of what type of Kerberos installation is being used
abstracted.
A keytab is an on-disk store for the key or keys for a Kerberos principal.
@@ -254,15 +242,15 @@ information about how to set wallet configuration.
=item addprinc(PRINCIPAL)
-Adds a new principal with a given name. The principal is created with a
-random password, and any other flags set by Wallet::Config. Returns true on
+Adds a new principal with a given name. The principal is created with a
+random password, and any other flags set by Wallet::Config. Returns true on
success, or throws an error if there was a failure in adding the principal.
-If the principal already exists, return true as we are bringing our
+If the principal already exists, return true as we are bringing our
expectations in line with reality.
=item addprinc(PRINCIPAL)
-Removes a principal with the given name. Returns true on success, or throws
+Removes a principal with the given name. Returns true on success, or throws
an error if there was a failure in removing the principal. If the principal
does not exist, return true as we are bringing our expectations in line with
reality.
@@ -270,8 +258,8 @@ reality.
=item ktadd(PRINCIPAL, FILE, ENCTYPES)
Creates a new keytab for the given principal, as the given file, limited to
-the enctypes supplied. The enctype values must be enctype strings recognized
-by Kerberos (strings like C<aes256-cts> or C<des-cbc-crc>). An error is
+the enctypes supplied. The enctype values must be enctype strings recognized
+by Kerberos (strings like C<aes256-cts> or C<des-cbc-crc>). An error is
thrown on failure or if the creation fails, otherwise true is returned.
=back
@@ -279,7 +267,7 @@ thrown on failure or if the creation fails, otherwise true is returned.
=head1 LIMITATIONS
Currently, this implementation calls an external B<kadmin> program rather
- than using a native Perl module and therefore requires B<kadmin> be
+ than using a native Perl module and therefore requires B<kadmin> be
installed and parses its output. It may miss some error conditions if the
output of B<kadmin> ever changes.
diff --git a/perl/Wallet/Kadmin/MIT.pm b/perl/Wallet/Kadmin/MIT.pm
index b7d4913..7bbb248 100644
--- a/perl/Wallet/Kadmin/MIT.pm
+++ b/perl/Wallet/Kadmin/MIT.pm
@@ -130,7 +130,7 @@ sub addprinc {
sub ktadd {
my ($self, $principal, $file, @enctypes) = @_;
unless ($self->valid_principal ($principal)) {
- die ("invalid principal name: $principal");
+ die "invalid principal name: $principal\n";
}
if ($Wallet::Config::KEYTAB_REALM) {
$principal .= '@' . $Wallet::Config::KEYTAB_REALM;
@@ -143,7 +143,7 @@ sub ktadd {
my $output = eval { $self->kadmin ("$command $principal") };
die ($@) if ($@);
if ($output =~ /^(?:kadmin|ktadd): (.*)/m) {
- die ("error creating keytab for $principal: $1");
+ die "error creating keytab for $principal: $1\n";
}
return 1;
}
@@ -154,7 +154,7 @@ sub ktadd {
sub delprinc {
my ($self, $principal) = @_;
unless ($self->valid_principal ($principal)) {
- die ("invalid principal name: $principal");
+ die "invalid principal name: $principal\n";
}
my $exists = eval { $self->exists ($principal) };
die $@ if $@;
@@ -167,7 +167,7 @@ sub delprinc {
my $output = eval { $self->kadmin ("delprinc -force $principal") };
die $@ if $@;
if ($output =~ /^delete_principal: (.*)/m) {
- die ("error deleting $principal: $1");
+ die "error deleting $principal: $1\n";
}
return 1;
}
@@ -177,12 +177,11 @@ sub delprinc {
##############################################################################
# Create a new MIT kadmin object. Very empty for the moment, but later it
-# will probably fill out if we go to using a module rather than calling
+# will probably fill out if we go to using a module rather than calling
# kadmin directly.
sub new {
my ($class) = @_;
- my $self = {
- };
+ my $self = {};
bless ($self, $class);
return $self;
}
@@ -212,7 +211,7 @@ Wallet::Kadmin::MIT is an interface for keytab integration with the wallet,
specifically for using kadmin to create, delete, and add enctypes to keytabs.
It implments the wallet kadmin API and provides the necessary glue to MIT
Kerberos installs for each of these functions, while allowing the wallet
-to keep the details of what type of Kerberos installation is being used
+to keep the details of what type of Kerberos installation is being used
abstracted.
A keytab is an on-disk store for the key or keys for a Kerberos principal.
@@ -231,15 +230,15 @@ information about how to set wallet configuration.
=item addprinc(PRINCIPAL)
-Adds a new principal with a given name. The principal is created with a
-random password, and any other flags set by Wallet::Config. Returns true on
+Adds a new principal with a given name. The principal is created with a
+random password, and any other flags set by Wallet::Config. Returns true on
success, or throws an error if there was a failure in adding the principal.
-If the principal already exists, return true as we are bringing our
+If the principal already exists, return true as we are bringing our
expectations in line with reality.
=item addprinc(PRINCIPAL)
-Removes a principal with the given name. Returns true on success, or throws
+Removes a principal with the given name. Returns true on success, or throws
an error if there was a failure in removing the principal. If the principal
does not exist, return true as we are bringing our expectations in line with
reality.
@@ -247,8 +246,8 @@ reality.
=item ktadd(PRINCIPAL, FILE, ENCTYPES)
Creates a new keytab for the given principal, as the given file, limited to
-the enctypes supplied. The enctype values must be enctype strings recognized
-by Kerberos (strings like C<aes256-cts> or C<des-cbc-crc>). An error is
+the enctypes supplied. The enctype values must be enctype strings recognized
+by Kerberos (strings like C<aes256-cts> or C<des-cbc-crc>). An error is
thrown on failure or if the creation fails, otherwise true is returned.
=back
@@ -256,7 +255,7 @@ thrown on failure or if the creation fails, otherwise true is returned.
=head1 LIMITATIONS
Currently, this implementation calls an external B<kadmin> program rather
- than using a native Perl module and therefore requires B<kadmin> be
+than using a native Perl module and therefore requires B<kadmin> be
installed and parses its output. It may miss some error conditions if the
output of B<kadmin> ever changes.
@@ -269,7 +268,6 @@ from L<http://www.eyrie.org/~eagle/software/wallet/>.
=head1 AUTHORS
-Russ Allbery <rra@stanford.edu>
-Jon Robertson <jonrober@stanford.edu>
+Russ Allbery <rra@stanford.edu> and Jon Robertson <jonrober@stanford.edu>.
=cut
diff --git a/perl/Wallet/Object/Base.pm b/perl/Wallet/Object/Base.pm
index f2568eb..fea0320 100644
--- a/perl/Wallet/Object/Base.pm
+++ b/perl/Wallet/Object/Base.pm
@@ -445,7 +445,7 @@ sub flag_set {
# History
##############################################################################
-# Expand a given ACL id to add its name, for readability. Returns the
+# Expand a given ACL id to add its name, for readability. Returns the
# original id alone if there was a problem finding the name.
sub format_acl_id {
my ($self, $id) = @_;
@@ -455,7 +455,7 @@ sub format_acl_id {
my $sth = $self->{dbh}->prepare ($sql);
$sth->execute ($id);
if (my @ref = $sth->fetchrow_array) {
- $name = $ref[0] . " ($id)";
+ $name = $ref[0] . " ($id)";
}
return $name;
@@ -492,11 +492,11 @@ sub history {
} elsif (defined ($new)) {
$output .= "add $new to attribute $attr";
}
- } elsif ($data[0] eq 'set'
- and ($data[1] eq 'owner' or $data[1] =~ /^acl_/)) {
+ } elsif ($data[0] eq 'set'
+ and ($data[1] eq 'owner' or $data[1] =~ /^acl_/)) {
my $field = $data[1];
- $old = $self->format_acl_id ($old) if defined ($old);
- $new = $self->format_acl_id ($new) if defined ($new);
+ $old = $self->format_acl_id ($old) if defined ($old);
+ $new = $self->format_acl_id ($new) if defined ($new);
if (defined ($old) and defined ($new)) {
$output .= "set $field to $new (was $old)";
} elsif (defined ($new)) {
diff --git a/perl/Wallet/Object/Keytab.pm b/perl/Wallet/Object/Keytab.pm
index b1c9d6d..a361599 100644
--- a/perl/Wallet/Object/Keytab.pm
+++ b/perl/Wallet/Object/Keytab.pm
@@ -1,7 +1,7 @@
# Wallet::Object::Keytab -- Keytab object implementation for the wallet.
#
# Written by Russ Allbery <rra@stanford.edu>
-# Copyright 2007, 2008 Board of Trustees, Leland Stanford Jr. University
+# Copyright 2007, 2008, 2009 Board of Trustees, Leland Stanford Jr. University
#
# See LICENSE for licensing terms.
@@ -477,15 +477,14 @@ sub new {
# caller.
sub create {
my ($class, $type, $name, $dbh, $creator, $host, $time) = @_;
- my $self = {
- dbh => $dbh,
- kadmin => undef,
+ my $self = {
+ dbh => $dbh,
+ kadmin => undef,
};
bless $self, $class;
my $kadmin = Wallet::Kadmin->new ();
$self->{kadmin} = $kadmin;
$kadmin->addprinc ($name);
-
$self = $class->SUPER::create ($type, $name, $dbh, $creator, $host, $time);
$self->{kadmin} = $kadmin;
return $self;
@@ -556,8 +555,8 @@ sub get {
my $kadmin = $self->{kadmin};
my $retval = eval { $kadmin->ktadd ($self->{name}, $file, @enctypes) };
if ($@) {
- $self->error ($@);
- return;
+ $self->error ($@);
+ return;
}
return unless $retval;
local *KEYTAB;