[27480] in Kerberos

home help back first fref pref prev next nref lref last post

Re: KfW 3.1: Re-directed stderr of kinit/klist displays dialog

daemon@ATHENA.MIT.EDU (Christopher D. Clausen)
Tue Feb 20 19:23:57 2007

Message-ID: <6C19D6637F134D4A885DCE3AF06CEC0D@CDCHOME>
From: "Christopher D. Clausen" <cclausen@acm.org>
To: <kerberos@mit.edu>
Date: Tue, 20 Feb 2007 18:23:29 -0600
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: kerberos-bounces@mit.edu

petesea@bigfoot.com wrote:
> On Tue, 20 Feb 2007, Jeffrey Altman wrote:
>> petesea@bigfoot.com wrote:
>>
>>> Is there a way to redirect stderr from kinit/klist to a file?
>>
>> stdin and stderr cannot be redirected.  they are used for password
>> prompting
>
> Hmmm.... but I'm not trying to redirect the password prompt... in
> fact, kinit won't let me redirect the password prompt, it still
> displays it in the shell (NOT as a Windows dialog):
>
>   C:\> kinit 2>err.our
>   Password for bozo@CLOWN.COM:
>
> That's fine.... and I'm not suggesting it should work any
> different... for the password prompt that is...
>
> But if I'm using "kinit -kt" or "klist" or "kdestroy"... (none of
> which should prompt for a password or require any keyboard input),
> then I think you should be able to redirect stderr.
>
> Unfortunately, if I try to run any of those commands and I get an
> error AND stderr is re-directed then I get a Windows dialog instead.
>
>   C:\> kinit -kt foobar 2>err.out
>   (Windows dialog with error, nothing in err.out)
>
> The problem is, if you're running an automated background job using a
> keytab and something's wrong (eg the keytab is missing), it makes it
> VERY difficult to find the problem.  You can't redirect stderr
> because that triggers a Windows dialog which could cause the
> background job to hang waiting for user input it's never going to
> get.  Or if it doesn't hang, there's no way to log the error to see
> why it failed.

Well, can't you check the exit error codes set by the program?

C:\>kinit -kt test
kinit(v5): Cannot resolve network address for KDC in requested realm 
while getting initial credentials
C:\>echo %ERRORLEVEL%
1
C:\>klist
klist: No credentials cache found (ticket cache 
API:notguest@AD.UIUC.EDU)
C:\>echo %ERRORLEVEL%
1
C:\>kinit cclausen
Password for cclausen@AD.UIUC.EDU:
C:\>echo %ERRORLEVEL%
0
C:\>klist
Ticket cache: API:notguest@AD.UIUC.EDU
Default principal: cclausen@AD.UIUC.EDU
Valid starting     Expires            Service principal
02/20/07 18:14:49  02/21/07 04:14:49  krbtgt/AD.UIUC.EDU@AD.UIUC.EDU
C:\>echo %ERRORLEVEL%
0

Also, I can redirect the klist output just fine.  What are you doing?

C:\>klist 2>&1 1>%TEMP%\test.txt
C:\>cat %TEMP%\test.txt
Ticket cache: API:notguest@AD.UIUC.EDU
Default principal: cclausen@AD.UIUC.EDU
Valid starting     Expires            Service principal
02/20/07 18:14:49  02/21/07 04:14:49  krbtgt/AD.UIUC.EDU@AD.UIUC.EDU
C:\>

But yes, I'd agree that dialogs from kinit stderr redirection attempts 
are quite odd and unexpected.

<<CDC 


________________________________________________
Kerberos mailing list           Kerberos@mit.edu
https://mailman.mit.edu/mailman/listinfo/kerberos

home help back first fref pref prev next nref lref last post