TODO debug samba_kdc_lookup_realm
authorStefan Metzmacher <metze@samba.org>
Wed, 9 Mar 2022 18:01:54 +0000 (19:01 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 2 Feb 2024 10:31:16 +0000 (11:31 +0100)
source4/kdc/db-glue.c

index 5cd14c7b4c764a10b85c8bb0b04d799368570309..d1f4610820b729ee290f02b7aa8d9dd81c021168 100644 (file)
@@ -2898,6 +2898,7 @@ static krb5_error_code samba_kdc_lookup_realm(krb5_context context,
        bool ok;
        char *upper = NULL;
        bool get_krbtgt = false;
+       char *princ_str = NULL;
 
        *entry = (struct sdb_entry) {};
 
@@ -2914,6 +2915,8 @@ static krb5_error_code samba_kdc_lookup_realm(krb5_context context,
                }
        }
 
+       smb_krb5_unparse_name(frame, context, principal, &princ_str);
+
        if (!check_realm) {
                TALLOC_FREE(frame);
                return 0;
@@ -3034,6 +3037,12 @@ static krb5_error_code samba_kdc_lookup_realm(krb5_context context,
                return 0;
        }
 
+       DBG_ERR("%s: princ_str[%s] check_realm[%u] local_realm[%s] realm[%s]\n",
+               __location__,
+               princ_str,
+               check_realm,
+               lpcfg_realm(kdc_db_ctx->lp_ctx),
+               realm);
        status = dsdb_trust_routing_table_load(kdc_db_ctx->samdb,
                                               frame, &trt);
        if (!NT_STATUS_IS_OK(status)) {
@@ -3046,6 +3055,12 @@ static krb5_error_code samba_kdc_lookup_realm(krb5_context context,
                /*
                 * This principal has to be local
                 */
+       DBG_ERR("%s: princ_str[%s] check_realm[%u] local_realm[%s] realm[%s]\n",
+               __location__,
+               princ_str,
+               check_realm,
+               lpcfg_realm(kdc_db_ctx->lp_ctx),
+               realm);
                TALLOC_FREE(frame);
                return 0;
        }
@@ -3056,6 +3071,12 @@ static krb5_error_code samba_kdc_lookup_realm(krb5_context context,
                        /*
                         * This principal has to be local
                         */
+       DBG_ERR("%s: princ_str[%s] check_realm[%u] local_realm[%s] realm[%s]\n",
+               __location__,
+               princ_str,
+               check_realm,
+               lpcfg_realm(kdc_db_ctx->lp_ctx),
+               realm);
                        TALLOC_FREE(frame);
                        return 0;
                }
@@ -3064,6 +3085,12 @@ static krb5_error_code samba_kdc_lookup_realm(krb5_context context,
                        /*
                         * This principal has to be local
                         */
+       DBG_ERR("%s: princ_str[%s] check_realm[%u] local_realm[%s] realm[%s]\n",
+               __location__,
+               princ_str,
+               check_realm,
+               lpcfg_realm(kdc_db_ctx->lp_ctx),
+               realm);
                        TALLOC_FREE(frame);
                        return 0;
                }
@@ -3086,10 +3113,23 @@ static krb5_error_code samba_kdc_lookup_realm(krb5_context context,
                 *
                 * Just search in our local database.
                 */
+       DBG_ERR("%s: princ_str[%s] check_realm[%u] local_realm[%s] realm[%s]\n",
+               __location__,
+               princ_str,
+               check_realm,
+               lpcfg_realm(kdc_db_ctx->lp_ctx),
+               realm);
                TALLOC_FREE(frame);
                return 0;
        }
 
+       DBG_ERR("%s: princ_str[%s] check_realm[%u] local_realm[%s] realm[%s]\n",
+               __location__,
+               princ_str,
+               check_realm,
+               lpcfg_realm(kdc_db_ctx->lp_ctx),
+               realm);
+
        ret = krb5_copy_principal(context, principal,
                                  &entry->principal);
        if (ret) {
@@ -3111,6 +3151,13 @@ static krb5_error_code samba_kdc_lookup_realm(krb5_context context,
                return ret;
        }
 
+       DBG_ERR("%s: princ_str[%s] check_realm[%u] local_realm[%s] realm[%s] upper[%s]\n",
+               __location__,
+               princ_str,
+               check_realm,
+               lpcfg_realm(kdc_db_ctx->lp_ctx),
+               realm,
+               upper);
        TALLOC_FREE(frame);
        return SDB_ERR_WRONG_REALM;
 }