aboutsummaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2010-02-08 19:46:54 -0800
committerRuss Allbery <rra@stanford.edu>2010-02-08 19:46:54 -0800
commita96f4abbbe8176101584e414be5139e244377025 (patch)
tree8bba9465eef92cd581127f8f2b22948ecfb9da72 /perl
parentb093893870d56cd460b16645496ec6c30c62a02f (diff)
Use Wallet::Kadmin to do kadmin operations in the keytab test
Now that we have Wallet::Kadmin, use it, rather than running the kadmin client program. We may not have the same kadmin client program as the server that we're testing against.
Diffstat (limited to 'perl')
-rwxr-xr-xperl/t/keytab.t36
1 files changed, 8 insertions, 28 deletions
diff --git a/perl/t/keytab.t b/perl/t/keytab.t
index 5488e28..25e946c 100755
--- a/perl/t/keytab.t
+++ b/perl/t/keytab.t
@@ -3,16 +3,17 @@
# t/keytab.t -- Tests for the keytab object implementation.
#
# Written by Russ Allbery <rra@stanford.edu>
-# Copyright 2007, 2008 Board of Trustees, Leland Stanford Jr. University
+# Copyright 2007, 2008, 2009, 2010
+# Board of Trustees, Leland Stanford Jr. University
#
# See LICENSE for licensing terms.
use POSIX qw(strftime);
-use Test::More tests => 212
-;
+use Test::More tests => 212;
use Wallet::Admin;
use Wallet::Config;
+use Wallet::Kadmin;
use Wallet::Object::Keytab;
use lib 't/lib';
@@ -57,37 +58,16 @@ sub system_quiet {
# been set up.
sub create {
my ($principal) = @_;
- if ($Wallet::Config::KEYTAB_KRBTYPE eq 'MIT') {
- my @args = ('-p', $Wallet::Config::KEYTAB_PRINCIPAL, '-k',
- '-t', $Wallet::Config::KEYTAB_FILE,
- '-r', $Wallet::Config::KEYTAB_REALM,
- '-q', "addprinc -clearpolicy -randkey $principal");
- } elsif ($Wallet::Config::KEYTAB_KRBTYPE eq 'Heimdal') {
- @args = ('-p', $Wallet::Config::KEYTAB_PRINCIPAL,
- '-K', $Wallet::Config::KEYTAB_FILE,
- '-r', $Wallet::Config::KEYTAB_REALM,
- 'add', $principal);
- }
- system_quiet ($Wallet::Config::KEYTAB_KADMIN, @args);
+ my $kadmin = Wallet::Kadmin->new;
+ return $kadmin->addprinc ($principal);
}
# Destroy a principal out of Kerberos. Only usable once the configuration has
# been set up.
sub destroy {
my ($principal) = @_;
- my (@args);
- if ($Wallet::Config::KEYTAB_KRBTYPE eq 'MIT') {
- @args = ('-p', $Wallet::Config::KEYTAB_PRINCIPAL, '-k',
- '-t', $Wallet::Config::KEYTAB_FILE,
- '-r', $Wallet::Config::KEYTAB_REALM,
- '-q', "delprinc -force $principal");
- } elsif ($Wallet::Config::KEYTAB_KRBTYPE eq 'Heimdal') {
- @args = ('-p', $Wallet::Config::KEYTAB_PRINCIPAL,
- '-K', $Wallet::Config::KEYTAB_FILE,
- '-r', $Wallet::Config::KEYTAB_REALM,
- 'delete', $principal);
- }
- system_quiet ($Wallet::Config::KEYTAB_KADMIN, @args);
+ my $kadmin = Wallet::Kadmin->new;
+ return $kadmin->delprinc ($principal);
}
# Check whether a principal exists. MIT uses kvno and Heimdal uses kgetcred.