diff options
author | Jon Robertson <jonrober@stanford.edu> | 2010-01-26 14:45:40 -0800 |
---|---|---|
committer | Jon Robertson <jonrober@stanford.edu> | 2010-01-26 14:45:40 -0800 |
commit | dad764bc84d371ffc775e66b942ecbbc59f05c8e (patch) | |
tree | c7899de42e07da4f6554e2bddeaa38e5aeb969d6 /perl/t/kadmin.t | |
parent | 364f19c6200dfa7e96e5236a538b4092154b28e8 (diff) |
Added way to clean things during a fork for kadmin
The MIT kadmin module currently directly runs the MIT kadmin program. Some
data needs to be cleaned during the forks for this. This provides a
callback that can be registered and is called during the fork process,
currently just to mark database handles inactive. It was added to both the
MIT and Heimdal modules, though it's only a stub in the Heimdal module.
Heimdal is not forking kadmin, but the stub is there in order to allow the
caller to not care which module is being used and just always register the
callbacks.
Diffstat (limited to 'perl/t/kadmin.t')
-rwxr-xr-x | perl/t/kadmin.t | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/perl/t/kadmin.t b/perl/t/kadmin.t index 7423ed1..8ecc2c1 100755 --- a/perl/t/kadmin.t +++ b/perl/t/kadmin.t @@ -8,7 +8,7 @@ # See LICENSE for licensing terms. use POSIX qw(strftime); -use Test::More tests => 15; +use Test::More tests => 17; use Wallet::Admin; use Wallet::Config; @@ -34,11 +34,16 @@ for my $good (qw{service service/foo bar foo/bar host/example.org "Valid principal name $good"); } -# Test creating an MIT object. We don't care about anything but correctly -# creating it -- testing operations is for the keytab tests. +# Test creating an MIT object and seeing if the callback works. $Wallet::Config::KEYTAB_KRBTYPE = 'MIT'; my $kadmin = Wallet::Kadmin->new (); ok (defined ($kadmin), 'MIT kadmin object created'); +my $callback = sub { return 1 }; +$kadmin->fork_callback ($callback); +is ($kadmin->{fork_callback} (), 1, ' and callback works.'); +my $callback = sub { return 2 }; +$kadmin->fork_callback ($callback); +is ($kadmin->{fork_callback} (), 2, ' and changing it works.'); # Test creating a Heimdal object. For us to test a working Heimdal object, # we need a properly configured Heimdal KDC. So instead, we deliberately |