diff options
author | Michal Zidek <mzidek@redhat.com> | 2012-10-15 12:21:00 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-02 17:44:09 +0100 |
commit | 04759b59e71c78ab23b84d13dd29d9c6dd680adb (patch) | |
tree | de8f6137712f7fc8ade86a7a89bb96905db3a240 /src/providers/ldap | |
parent | fc647b8eb5bca901658dedf3dbda2f35c63a86f2 (diff) | |
download | sssd-04759b59e71c78ab23b84d13dd29d9c6dd680adb.tar.gz sssd-04759b59e71c78ab23b84d13dd29d9c6dd680adb.tar.xz sssd-04759b59e71c78ab23b84d13dd29d9c6dd680adb.zip |
failover: Protect against empty host names
Added new parameter to split_on_separator that allows to skip
empty values.
The whole function was rewritten. Unit test case was added to
check the new implementation.
https://fedorahosted.org/sssd/ticket/1484
Diffstat (limited to 'src/providers/ldap')
-rw-r--r-- | src/providers/ldap/ldap_common.c | 4 | ||||
-rw-r--r-- | src/providers/ldap/ldap_init.c | 2 | ||||
-rw-r--r-- | src/providers/ldap/sdap_async_sudo_hostinfo.c | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c index f8b921adf..a97dc34e2 100644 --- a/src/providers/ldap/ldap_common.c +++ b/src/providers/ldap/ldap_common.c @@ -561,7 +561,7 @@ errno_t common_parse_search_base(TALLOC_CTX *mem_ctx, goto done; } - ret = split_on_separator(tmp_ctx, unparsed_base, '?', false, + ret = split_on_separator(tmp_ctx, unparsed_base, '?', false, false, &split_bases, &count); if (ret != EOK) goto done; @@ -1214,7 +1214,7 @@ errno_t sdap_urls_init(struct be_ctx *ctx, /* split server parm into a list */ - ret = split_on_separator(tmp_ctx, urls, ',', true, &list, NULL); + ret = split_on_separator(tmp_ctx, urls, ',', true, true, &list, NULL); if (ret != EOK) { DEBUG(1, ("Failed to parse server list!\n")); goto done; diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c index 52bd233f1..807526b88 100644 --- a/src/providers/ldap/ldap_init.c +++ b/src/providers/ldap/ldap_init.c @@ -294,7 +294,7 @@ int sssm_ldap_access_init(struct be_ctx *bectx, order = "filter"; } - ret = split_on_separator(access_ctx, order, ',', true, + ret = split_on_separator(access_ctx, order, ',', true, true, &order_list, &order_list_len); if (ret != EOK) { DEBUG(1, ("split_on_separator failed.\n")); diff --git a/src/providers/ldap/sdap_async_sudo_hostinfo.c b/src/providers/ldap/sdap_async_sudo_hostinfo.c index 0a695cdbf..f47e98651 100644 --- a/src/providers/ldap/sdap_async_sudo_hostinfo.c +++ b/src/providers/ldap/sdap_async_sudo_hostinfo.c @@ -89,7 +89,7 @@ struct tevent_req * sdap_sudo_get_hostinfo_send(TALLOC_CTX *mem_ctx, conf_ip_addr = dp_opt_get_string(opts->basic, SDAP_SUDO_IP); if (conf_hostnames != NULL) { - ret = split_on_separator(state, conf_hostnames, ' ', true, + ret = split_on_separator(state, conf_hostnames, ' ', true, true, &state->hostnames, NULL); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, @@ -102,7 +102,7 @@ struct tevent_req * sdap_sudo_get_hostinfo_send(TALLOC_CTX *mem_ctx, } if (conf_ip_addr != NULL) { - ret = split_on_separator(state, conf_ip_addr, ' ', true, + ret = split_on_separator(state, conf_ip_addr, ' ', true, true, &state->ip_addr, NULL); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, |