How to use krb5_get_error_message() when context initialization failed?

Greg Hudson ghudson at MIT.EDU
Tue Feb 26 12:24:23 EST 2013


On 02/26/2013 09:05 AM, Petr Spacek wrote:
> I tried following C code snippet and it worked, but I want to ask Kerberos 
> experts to be sure that it will not blow up:
> 
> krberr = krb5_init_context(&context);
> if (krberr)
> 	krb5_get_error_message(NULL, krberr);

This should be fine in either MIT krb5 and Heimdal.  In MIT krb5 it's
equivalent to calling error_message(krberr) (a com_err function).  In
Heimdal it's a little more complicated.

Of course, you won't get an extended error message this way, only a
simple translation of the number to an error table string.



More information about the Kerberos mailing list