From 1e28788f0b0f5cae3dd815f07d39ad70e7da0ce2 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 18 May 2010 16:47:31 -0700 Subject: Fix error handling for klist with Heimdal user space The check for the enctypes of created keytabs tries klist for MIT first and then Heimdal ktutil. The klist options are invalid for Heimdal. Suppress the resulting complaining to standard error. --- perl/t/keytab.t | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'perl/t/keytab.t') diff --git a/perl/t/keytab.t b/perl/t/keytab.t index b16cea5..fabdc5b 100755 --- a/perl/t/keytab.t +++ b/perl/t/keytab.t @@ -103,8 +103,14 @@ sub enctypes { close KEYTAB; my @enctypes; - open (KLIST, '-|', 'klist', '-ke', 'keytab') - or die "cannot run klist: $!\n"; + my $pid = open (KLIST, '-|'); + if (not defined $pid) { + die "cannot fork: $!\n"; + } elsif ($pid == 0) { + open (STDERR, '>', '/dev/null') or die "cannot reopen stderr: $!\n"; + exec ('klist', '-ke', 'keytab') + or die "cannot run klist: $!\n"; + } local $_; while () { next unless /^ *\d+ /; -- cgit v1.2.3