From fe1aad767948f4636c2251b0cf7b6a25f9bf7145 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Oct 13 2017 11:43:35 +0000 Subject: ipa-kdb: reinit trusted domain data for enterprise principals While processing enterprise principals the information about trusted domains might not be up-to-date. With this patch ipadb_reinit_mspac() is called if an unknown domain is part of the enterprise principal. Resolves https://pagure.io/freeipa/issue/7172 Reviewed-By: Alexander Bokovoy Reviewed-By: Rob Crittenden --- diff --git a/daemons/ipa-kdb/ipa_kdb_principals.c b/daemons/ipa-kdb/ipa_kdb_principals.c index 82c8574..b276122 100644 --- a/daemons/ipa-kdb/ipa_kdb_principals.c +++ b/daemons/ipa-kdb/ipa_kdb_principals.c @@ -1259,6 +1259,17 @@ krb5_error_code ipadb_get_principal(krb5_context kcontext, realm, upn->length - (realm - upn->data), &trusted_realm); + if (kerr == KRB5_KDB_NOENTRY) { + /* try to refresh trusted domain data and try again */ + kerr = ipadb_reinit_mspac(ipactx, false); + if (kerr != 0) { + kerr = KRB5_KDB_NOENTRY; + goto done; + } + kerr = ipadb_is_princ_from_trusted_realm(kcontext, realm, + upn->length - (realm - upn->data), + &trusted_realm); + } if (kerr == 0) { kentry = calloc(1, sizeof(krb5_db_entry)); if (!kentry) {