krb5 commit [krb5-1.11]: Improve LDAP KDB initialization error messages

Tom Yu tlyu at MIT.EDU
Wed Oct 30 17:43:27 EDT 2013


https://github.com/krb5/krb5/commit/c5d314a17953277c92c2be5b3049cfa580489684
commit c5d314a17953277c92c2be5b3049cfa580489684
Author: Greg Hudson <ghudson at mit.edu>
Date:   Mon Oct 28 11:23:11 2013 -0400

    Improve LDAP KDB initialization error messages
    
    In krb5_ldap_initialize, don't just blat the LDAP error into the
    extended message; give an indication of which LDAP operation we were
    trying to do and show what parameters we gave to it.
    
    (Also, krb5_set_error_message can handle a null context argument, so
    don't bother to check before calling.)
    
    (cherry picked from commit 5a77bb85294f37d1dfa4c7faedfdfb0d7faaf8dc)
    
    ticket: 7747 (new)
    version_fixed: 1.11.4
    status: resolved

 src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap_conn.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap_conn.c b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap_conn.c
index 5896724..be8f07c 100644
--- a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap_conn.c
+++ b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap_conn.c
@@ -157,9 +157,9 @@ krb5_ldap_initialize(krb5_ldap_context *ldap_context,
 
     /* ldap init */
     if ((st = ldap_initialize(&ldap_server_handle->ldap_handle, server_info->server_name)) != 0) {
-        if (ldap_context->kcontext)
-            krb5_set_error_message (ldap_context->kcontext, KRB5_KDB_ACCESS_ERROR, "%s",
-                                    ldap_err2string(st));
+        krb5_set_error_message(ldap_context->kcontext, KRB5_KDB_ACCESS_ERROR,
+                               _("Cannot create LDAP handle for '%s': %s"),
+                               server_info->server_name, ldap_err2string(st));
         st = KRB5_KDB_ACCESS_ERROR;
         goto err_out;
     }
@@ -169,10 +169,10 @@ krb5_ldap_initialize(krb5_ldap_context *ldap_context,
         server_info->server_status = ON;
         krb5_update_ldap_handle(ldap_server_handle, server_info);
     } else {
-        if (ldap_context->kcontext)
-            krb5_set_error_message (ldap_context->kcontext,
-                                    KRB5_KDB_ACCESS_ERROR, "%s",
-                                    ldap_err2string(st));
+        krb5_set_error_message(ldap_context->kcontext, KRB5_KDB_ACCESS_ERROR,
+                               _("Cannot bind to LDAP server '%s' as '%s'"
+                                 ": %s"), server_info->server_name,
+                               ldap_context->bind_dn, ldap_err2string(st));
         st = KRB5_KDB_ACCESS_ERROR;
         server_info->server_status = OFF;
         time(&server_info->downtime);


More information about the cvs-krb5 mailing list