krb5.init_context() currently just returns a null pointer if the C routine fails, which is unlike the norm in this module and I assume is an oversight. Typically this will fail if there's a syntax error in the libkrb5 configuration (/etc/krb5.conf, or whatever is read). A program using pykrb5 that I wrote segfaulted in this situation, because I then passed the null context to other routines. With this change, we get instead:
In [2]: ctx = krb5.init_context()
---------------------------------------------------------------------------
Krb5Error Traceback (most recent call last)
...
Krb5Error: Included profile file could not be read -1429577697
krb5.init_context()
currently just returns a null pointer if the C routine fails, which is unlike the norm in this module and I assume is an oversight. Typically this will fail if there's a syntax error in the libkrb5 configuration (/etc/krb5.conf
, or whatever is read). A program using pykrb5 that I wrote segfaulted in this situation, because I then passed the null context to other routines. With this change, we get instead: