From d75e74b2d73326c0aa61d44cf58bf683e88f8230 Mon Sep 17 00:00:00 2001 From: Viktor Dukhovni Date: Mon, 21 Jul 2014 21:00:19 +0000 Subject: [PATCH] Avoid kinit NPE when default cred not in keytab --- kuser/kinit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kuser/kinit.c b/kuser/kinit.c index 5e6046dce..7e8a5aec1 100644 --- a/kuser/kinit.c +++ b/kuser/kinit.c @@ -1131,7 +1131,10 @@ get_princ_kt(krb5_context context, if (ret != 0 || (ret = krb5_kt_end_seq_get(context, kt, &cursor)) != 0) krb5_err(context, 1, ret, "get_princ_kt"); if (!*principal) - parse_name_realm(context, name, 0, NULL, principal); + if (name) + parse_name_realm(context, name, 0, NULL, principal); + else + krb5_err(context, 1, KRB5_CC_NOTFOUND, "get_princ_kt"); krb5_free_principal(context, tmp); free(def_realm);