From: Howard Chu Date: Fri, 15 Dec 2006 16:38:45 +0000 (+0000) Subject: Check for failure from k5adm init X-Git-Tag: OPENLDAP_REL_ENG_2_4_4ALPHA~8^2~368 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e05fdb41fc1a42dd23c913cea34f44133c2c8322;p=openldap Check for failure from k5adm init --- diff --git a/contrib/slapd-modules/smbk5pwd/smbk5pwd.c b/contrib/slapd-modules/smbk5pwd/smbk5pwd.c index 2f0c8f098c..6b674583eb 100644 --- a/contrib/slapd-modules/smbk5pwd/smbk5pwd.c +++ b/contrib/slapd-modules/smbk5pwd/smbk5pwd.c @@ -880,20 +880,32 @@ smbk5pwd_modules_init( smbk5pwd_t *pi ) ret = krb5_init_context(&context); if (ret) { Debug( LDAP_DEBUG_ANY, "smbk5pwd: " - "unable to initialize krb5 context.\n", - 0, 0, 0 ); + "unable to initialize krb5 context (%d).\n", + ret, 0, 0 ); oc_krb5KDCEntry = NULL; return -1; } - /* FIXME: check return code? */ ret = kadm5_s_init_with_password_ctx( context, KADM5_ADMIN_SERVICE, NULL, KADM5_ADMIN_SERVICE, &conf, 0, 0, &kadm_context ); + if (ret) { + char *err_str, *err_msg = ""; + err_str = krb5_get_error_string( context ); + if (!err_str) + err_msg = krb5_get_err_text( context, ret ); + Debug( LDAP_DEBUG_ANY, "smbk5pwd: " + "unable to initialize krb5 admin context: %s (%d).\n", + err_str ? err_str : err_msg, ret, 0 ); + if (err_str) + krb5_free_error_string( context, err_str ); + krb5_free_context( context ); + oc_krb5KDCEntry = NULL; + return -1; + } - /* FIXME: check return code? */ db = _kadm5_s_get_db( kadm_context ); } #endif /* DO_KRB5 */