krb5 commit: Set klog com_err context for each KDC request

Greg Hudson ghudson at mit.edu
Wed Jan 17 18:16:03 EST 2018


https://github.com/krb5/krb5/commit/3e1f1c281f977b253934a641753d09b261c84cdb
commit 3e1f1c281f977b253934a641753d09b261c84cdb
Author: Greg Hudson <ghudson at mit.edu>
Date:   Fri Jan 5 16:27:19 2018 -0500

    Set klog com_err context for each KDC request
    
    In setup_server_realm(), set the error context for the klog com_err
    hook so that com_err() can retrieve error messages using the per-realm
    context.
    
    ticket: 8630

 src/kdc/main.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/kdc/main.c b/src/kdc/main.c
index 919320d..e1ee3a9 100644
--- a/src/kdc/main.c
+++ b/src/kdc/main.c
@@ -127,14 +127,16 @@ setup_server_realm(struct server_handle *handle, krb5_principal sprinc)
         return NULL;
 
     if (kdc_numrealms > 1) {
-        if (!(newrealm = find_realm_data(handle, sprinc->realm.data,
-                                         (krb5_ui_4) sprinc->realm.length)))
-            return NULL;
-        else
-            return newrealm;
+        newrealm = find_realm_data(handle, sprinc->realm.data,
+                                   sprinc->realm.length);
+    } else {
+        newrealm = kdc_realmlist[0];
     }
-    else
-        return kdc_realmlist[0];
+    if (newrealm != NULL) {
+        krb5_klog_set_context(newrealm->realm_context);
+        shandle.kdc_err_context = newrealm->realm_context;
+    }
+    return newrealm;
 }
 
 static void


More information about the cvs-krb5 mailing list