summaryrefslogtreecommitdiffstats
path: root/daemons/ipa-slapi-plugins
diff options
context:
space:
mode:
authorLudwig Krispenz <lkrispen@redhat.com>2016-06-13 09:51:17 +0200
committerMartin Basti <mbasti@redhat.com>2016-06-13 16:25:03 +0200
commit0b11b36bf215a351050280ab0b329ceda7a9dccf (patch)
tree1c54965638fb5a8c6acb7794c63c51b88b4c8cd2 /daemons/ipa-slapi-plugins
parent493ae1e5028c6ce8a0888146ee3de6c798caa55f (diff)
downloadfreeipa-0b11b36bf215a351050280ab0b329ceda7a9dccf.tar.gz
freeipa-0b11b36bf215a351050280ab0b329ceda7a9dccf.tar.xz
freeipa-0b11b36bf215a351050280ab0b329ceda7a9dccf.zip
v2 - avoid crash in topology plugin when host list contains host with no hostname
ticket #5928 prevent a crash when dereferncing a NULL hostnam, log an error to help debugging fix an incorrect order of statement when freeing a host list Reviewed-By: Thierry Bordaz <tbordaz@redhat.com>
Diffstat (limited to 'daemons/ipa-slapi-plugins')
-rw-r--r--daemons/ipa-slapi-plugins/topology/topology_cfg.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/daemons/ipa-slapi-plugins/topology/topology_cfg.c b/daemons/ipa-slapi-plugins/topology/topology_cfg.c
index 3ca61a8ea..23b8eddfb 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_cfg.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_cfg.c
@@ -452,6 +452,15 @@ ipa_topo_cfg_host_find(TopoReplica *tconf, char *findhost, int lock)
if (lock) slapi_lock_mutex(tconf->repl_lock);
for (host=tconf->hosts;host;host=host->next) {
+ if (host->hostname == NULL) {
+ /* this check is done to avoid a crash,
+ * for which the root cause is not yet known.
+ * Avoid the crash and log an error
+ */
+ slapi_log_error(SLAPI_LOG_FATAL, IPA_TOPO_PLUGIN_SUBSYSTEM,
+ "ipa_topo_cfg_host_find: found a NULL hostname in host list\n");
+ continue;
+ }
if (!strcasecmp(host->hostname,findhost)) {
break;
}
@@ -849,8 +858,8 @@ ipa_topo_cfg_replica_free(TopoReplica *tconf)
while (host) {
host_next = host->next;
slapi_ch_free_string(&host->hostname);
- host = host_next;
slapi_ch_free((void **)&host);
+ host = host_next;
}
slapi_ch_free((void **)&tconf);
}