From 0f0423cf531d5fab73516323750af6b5106ba070 Mon Sep 17 00:00:00 2001 From: Thierry Bordaz Date: Jul 24 2017 11:34:06 +0000 Subject: NULL LDAP context in call to ldap_search_ext_s during search KDC crashes on quite random interval while trying to reach LDAP https://pagure.io/freeipa/issue/7017 Reviewed-By: Alexander Bokovoy --- diff --git a/daemons/ipa-kdb/ipa_kdb.c b/daemons/ipa-kdb/ipa_kdb.c index 050bfc9..c0f1e27 100644 --- a/daemons/ipa-kdb/ipa_kdb.c +++ b/daemons/ipa-kdb/ipa_kdb.c @@ -465,6 +465,12 @@ int ipadb_get_connection(struct ipadb_context *ipactx) ret = ipadb_reinit_mspac(ipactx, false); if (ret && ret != ENOENT) { /* TODO: log that there is an issue with adtrust settings */ + if (ipactx->lcontext == NULL) { + /* for some reason ldap connection was reset in ipadb_reinit_mspac + * and is no longer established => failure of ipadb_get_connection + */ + goto done; + } } ret = 0;