summaryrefslogtreecommitdiff
path: root/perl/Wallet/Object/Keytab.pm
diff options
context:
space:
mode:
authorJon Robertson <jonrober@stanford.edu>2010-01-26 14:45:40 -0800
committerJon Robertson <jonrober@stanford.edu>2010-01-26 14:45:40 -0800
commitdad764bc84d371ffc775e66b942ecbbc59f05c8e (patch)
treec7899de42e07da4f6554e2bddeaa38e5aeb969d6 /perl/Wallet/Object/Keytab.pm
parent364f19c6200dfa7e96e5236a538b4092154b28e8 (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/Wallet/Object/Keytab.pm')
-rw-r--r--perl/Wallet/Object/Keytab.pm13
1 files changed, 12 insertions, 1 deletions
diff --git a/perl/Wallet/Object/Keytab.pm b/perl/Wallet/Object/Keytab.pm
index 6733cf0..22598f1 100644
--- a/perl/Wallet/Object/Keytab.pm
+++ b/perl/Wallet/Object/Keytab.pm
@@ -466,6 +466,11 @@ sub new {
my $kadmin = Wallet::Kadmin->new ();
$self->{kadmin} = $kadmin;
+ # Set a callback for things to do after a fork, specifically for the MIT
+ # kadmin module which forks to kadmin.
+ my $callback = sub { $self->{dbh}->{InactiveDestroy} = 1 };
+ $kadmin->fork_callback ($callback);
+
$self = $class->SUPER::new ($type, $name, $dbh);
$self->{kadmin} = $kadmin;
return $self;
@@ -484,8 +489,14 @@ sub create {
bless $self, $class;
my $kadmin = Wallet::Kadmin->new ();
$self->{kadmin} = $kadmin;
+
+ # Set a callback for things to do after a fork, specifically for the MIT
+ # kadmin module which forks to kadmin.
+ my $callback = sub { $self->{dbh}->{InactiveDestroy} = 1 };
+ $kadmin->fork_callback ($callback);
+
if (not $kadmin->addprinc ($name)) {
- die $kadmin->error;
+ die $kadmin->error, "\n";
}
$self = $class->SUPER::create ($type, $name, $dbh, $creator, $host, $time);
$self->{kadmin} = $kadmin;