From 71ab261ffdb5be4c70c1e5575ee1547913ea77fa Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Fri, 4 Jan 2008 02:13:41 +0000 Subject: The build system now probes for GSS-API, Kerberos v5 and v4, and AFS libraries as necessary rather than hard-coding libraries. Building on systems without strong shared library dependencies and building against static libraries should now work. Building kasetkey (for AFS kaserver synchronization) is now optional and not enabled by default. Pass --with-afs to enable it. This allows wallet to be easily built in an environment without AFS. --- perl/t/keytab.t | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'perl') diff --git a/perl/t/keytab.t b/perl/t/keytab.t index 0dd6bc3..bb6b048 100755 --- a/perl/t/keytab.t +++ b/perl/t/keytab.t @@ -4,12 +4,12 @@ # t/keytab.t -- Tests for the keytab object implementation. # # Written by Russ Allbery -# Copyright 2007 Board of Trustees, Leland Stanford Jr. University +# Copyright 2007, 2008 Board of Trustees, Leland Stanford Jr. University # # See LICENSE for licensing terms. use POSIX qw(strftime); -use Test::More tests => 217; +use Test::More tests => 223; use Wallet::Config; use Wallet::Object::Keytab; @@ -478,7 +478,7 @@ EOO # Tests for kaserver synchronization support. SKIP: { - skip 'no keytab configuration', 100 unless -f 't/data/test.keytab'; + skip 'no keytab configuration', 106 unless -f 't/data/test.keytab'; # Test the principal mapping. We can do this without having a kaserver # configuration. We only need a basic keytab object configuration. Do @@ -569,9 +569,22 @@ $date add kaserver to attribute sync by $user from $host EOO is ($one->history, $history, ' and history is correct for attributes'); + is ($one->destroy (@trace), undef, 'Destroying wallet/one fails'); + is ($one->error, 'kaserver synchronization not configured', + ' because kaserver support is not configured'); + is ($one->attr ('sync', [], @trace), 1, + ' but removing the kaserver sync attribute works'); + is ($one->destroy (@trace),1, ' and then destroying wallet/one works'); + $history .= <<"EOO"; +$date remove kaserver from attribute sync + by $user from $host +$date destroy + by $user from $host +EOO # Set up our configuration. - skip 'no AFS kaserver configuration', 32 unless -f 't/data/test.srvtab'; + skip 'no AFS kaserver configuration', 34 unless -f 't/data/test.srvtab'; + skip 'no kaserver support', 34 unless -x '../kasetkey/kasetkey'; $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'); @@ -580,6 +593,14 @@ EOO my $realm = $Wallet::Config::KEYTAB_REALM; my $k5 = "wallet/one\@$realm"; + # Recreate and reconfigure the object. + $one = eval { + Wallet::Object::Keytab->create ('keytab', 'wallet/one', $dbh, @trace) + }; + ok (defined ($one), 'Creating wallet/one succeeds'); + is ($one->attr ('sync', [ 'kaserver' ], @trace), 1, + ' and setting the kaserver sync attribute works'); + # Finally, we can test. is ($one->get (@trace), undef, 'Get without configuration fails'); is ($one->error, 'kaserver synchronization not configured', @@ -661,6 +682,10 @@ EOO # Check that history is still correct. $history .= <<"EOO"; +$date create + by $user from $host +$date add kaserver to attribute sync + by $user from $host $date get by $user from $host $date remove kaserver from attribute sync @@ -704,7 +729,11 @@ SKIP: { my $one = eval { Wallet::Object::Keytab->create ('keytab', 'wallet/one', $dbh, @trace) }; - ok (defined ($one), 'Creating wallet/one succeeds'); + if (defined ($one)) { + ok (1, 'Creating wallet/one succeeds'); + } else { + is ($@, '', 'Creating wallet/one succeeds'); + } my $keytab = $one->get (@trace); ok (defined ($keytab), ' and retrieving the keytab works'); my @enctypes = grep { $_ ne 'UNKNOWN' } enctypes ($keytab); -- cgit v1.2.3