mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
committed by
Martin Basti
parent
493ae1e502
commit
0b11b36bf2
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user