aboutsummaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorJon Robertson <jonrober@stanford.edu>2010-01-28 00:07:16 -0800
committerJon Robertson <jonrober@stanford.edu>2010-01-28 00:07:16 -0800
commit04b875599b1d4559dbcd356726035416081c6b48 (patch)
treee32acfc088730da673c27a8aad9688944fee538d /perl
parent8d4899825cf723ef6a975306f146a06388ed4547 (diff)
Improved and fixed tests related to Pod and KDC type
Added a fix to the Pod tests to change the order of the arguments in a skip statement to the correct order. Also added tests for the KEYTAB_KRBTYPE value in the keytab tests, and changed the Wallet::Kadmin module to standardize the errors returned with no keytab set and add new error for keytab set but not a valid value.
Diffstat (limited to 'perl')
-rw-r--r--perl/Wallet/Kadmin.pm5
-rwxr-xr-xperl/t/keytab.t23
2 files changed, 24 insertions, 4 deletions
diff --git a/perl/Wallet/Kadmin.pm b/perl/Wallet/Kadmin.pm
index 95859a9..501bc37 100644
--- a/perl/Wallet/Kadmin.pm
+++ b/perl/Wallet/Kadmin.pm
@@ -32,7 +32,10 @@ $VERSION = '0.03';
sub new {
my ($class) = @_;
my ($kadmin);
- if ($Wallet::Config::KEYTAB_KRBTYPE eq 'MIT') {
+ if (!defined $Wallet::Config::KEYTAB_KRBTYPE
+ || !$Wallet::Config::KEYTAB_KRBTYPE) {
+ die "keytab object implementation not configured\n";
+ } elsif ($Wallet::Config::KEYTAB_KRBTYPE eq 'MIT') {
require Wallet::Kadmin::MIT;
$kadmin = Wallet::Kadmin::MIT->new ();
} elsif ($Wallet::Config::KEYTAB_KRBTYPE eq 'Heimdal') {
diff --git a/perl/t/keytab.t b/perl/t/keytab.t
index 7745290..ab5b19d 100755
--- a/perl/t/keytab.t
+++ b/perl/t/keytab.t
@@ -8,7 +8,7 @@
# See LICENSE for licensing terms.
use POSIX qw(strftime);
-use Test::More tests => 208
+use Test::More tests => 212
;
use Wallet::Admin;
@@ -387,6 +387,21 @@ EOO
is ($@, "keytab object implementation not configured\n",
' with the right error');
$Wallet::Config::KEYTAB_REALM = contents ('t/data/test.realm');
+ undef $Wallet::Config::KEYTAB_KRBTYPE;
+ $object = eval {
+ Wallet::Object::Keytab->create ('keytab', 'wallet/one', $dbh, @trace)
+ };
+ is ($object, undef, ' and another');
+ is ($@, "keytab object implementation not configured\n",
+ ' with the right error');
+ $Wallet::Config::KEYTAB_KRBTYPE = 'Active Directory';
+ $object = eval {
+ Wallet::Object::Keytab->create ('keytab', 'wallet/one', $dbh, @trace)
+ };
+ is ($object, undef, ' and one set to an invalid value');
+ is ($@, "keytab krb server type not set to a valid value\n",
+ ' with the right error');
+ $Wallet::Config::KEYTAB_KRBTYPE = contents ('t/data/test.krbtype');
}
# Tests for unchanging support. Skip these if we don't have a keytab or if we
@@ -403,6 +418,7 @@ SKIP: {
$Wallet::Config::KEYTAB_FILE = 't/data/test.keytab';
$Wallet::Config::KEYTAB_PRINCIPAL = contents ('t/data/test.principal');
$Wallet::Config::KEYTAB_REALM = contents ('t/data/test.realm');
+ $Wallet::Config::KEYTAB_KRBTYPE = contents ('t/data/test.krbtype');
$Wallet::Config::KEYTAB_TMP = '.';
my $realm = $Wallet::Config::KEYTAB_REALM;
my $principal = $Wallet::Config::KEYTAB_PRINCIPAL;
@@ -581,6 +597,7 @@ EOO
$Wallet::Config::KEYTAB_FILE = 't/data/test.keytab';
$Wallet::Config::KEYTAB_PRINCIPAL = contents ('t/data/test.principal');
$Wallet::Config::KEYTAB_REALM = contents ('t/data/test.realm');
+ $Wallet::Config::KEYTAB_KRBTYPE = contents ('t/data/test.krbtype');
$Wallet::Config::KEYTAB_TMP = '.';
$Wallet::Config::KEYTAB_AFS_KASETKEY = '../kasetkey/kasetkey';
my $realm = $Wallet::Config::KEYTAB_REALM;
@@ -707,8 +724,7 @@ EOO
# Tests for enctype restriction.
SKIP: {
- unless (-f 't/data/test.keytab'
- && $Wallet::Config::KEYTAB_KRBTYPE eq 'MIT') {
+ unless (-f 't/data/test.keytab') {
skip 'no keytab configuration', 36;
}
@@ -716,6 +732,7 @@ SKIP: {
$Wallet::Config::KEYTAB_FILE = 't/data/test.keytab';
$Wallet::Config::KEYTAB_PRINCIPAL = contents ('t/data/test.principal');
$Wallet::Config::KEYTAB_REALM = contents ('t/data/test.realm');
+ $Wallet::Config::KEYTAB_KRBTYPE = contents ('t/data/test.krbtype');
$Wallet::Config::KEYTAB_TMP = '.';
my $realm = $Wallet::Config::KEYTAB_REALM;
my $principal = $Wallet::Config::KEYTAB_PRINCIPAL;