diff options
author | Russ Allbery <rra@stanford.edu> | 2007-12-01 02:24:14 +0000 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2007-12-01 02:24:14 +0000 |
commit | 62f4dc22e3d9739c93c2b29acfdefb34afc448a2 (patch) | |
tree | fdef58134472a9422a414c1d9fb37436e6ef88f7 /perl/Wallet | |
parent | feb9f343f9e0b5e94132e878cdfeb2dc676aefb8 (diff) |
Don't use die when forking kasetkey fails and similarly don't close the
database connection on a failed fork.
Diffstat (limited to 'perl/Wallet')
-rw-r--r-- | perl/Wallet/Object/Keytab.pm | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/perl/Wallet/Object/Keytab.pm b/perl/Wallet/Object/Keytab.pm index 6254d6f..1189150 100644 --- a/perl/Wallet/Object/Keytab.pm +++ b/perl/Wallet/Object/Keytab.pm @@ -65,14 +65,13 @@ sub kadmin { # Don't use die here; it will get trapped as an exception. Also be # careful about our database handles. (We still lose if there's some # other database handle open we don't know about.) + $self->{dbh}->{InactiveDestroy} = 0 if ref $self; unless (open (STDERR, '>&STDOUT')) { warn "wallet: cannot dup stdout: $!\n"; - $self->{dbh}->{InactiveDestroy} = 0 if ref $self; exit 1; } unless (exec ($Wallet::Config::KEYTAB_KADMIN, @args)) { warn "wallet: cannot run $Wallet::Config::KEYTAB_KADMIN: $!\n"; - $self->{dbh}->{InactiveDestroy} = 0 if ref $self; exit 1; } } @@ -227,9 +226,18 @@ sub kaserver_kasetkey { $self->error ("cannot fork: $!"); return undef; } elsif ($pid == 0) { - open (STDERR, '>&STDOUT') or die "cannot redirect stderr: $!\n"; - exec ($kasetkey, '-k', $admin_srvtab, '-a', $admin, @args) - or die "cannot exec $kasetkey: $!\n"; + # Don't use die here; it will get trapped as an exception. Also be + # careful about our database handles. (We still lose if there's some + # other database handle open we don't know about.) + $self->{dbh}->{InactiveDestroy} = 0; + unless (open (STDERR, '>&STDOUT')) { + warn "cannot redirect stderr: $!\n"; + exit 1; + } + unless (exec ($kasetkey, '-k', $admin_srvtab, '-a', $admin, @args)) { + warn "cannot exec $kasetkey: $!\n"; + exit 1; + } } else { local $/; my $output = <KASETKEY>; |