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 | |
parent | fc647b8eb5bca901658dedf3dbda2f35c63a86f2 (diff) | |
download | sssd2-04759b59e71c78ab23b84d13dd29d9c6dd680adb.tar.gz sssd2-04759b59e71c78ab23b84d13dd29d9c6dd680adb.tar.xz sssd2-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')
-rw-r--r-- | src/providers/ad/ad_common.c | 2 | ||||
-rw-r--r-- | src/providers/ipa/ipa_common.c | 2 | ||||
-rw-r--r-- | src/providers/krb5/krb5_common.c | 2 | ||||
-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 |
6 files changed, 8 insertions, 8 deletions
diff --git a/src/providers/ad/ad_common.c b/src/providers/ad/ad_common.c index 8600dab2..dff1071d 100644 --- a/src/providers/ad/ad_common.c +++ b/src/providers/ad/ad_common.c @@ -156,7 +156,7 @@ ad_servers_init(TALLOC_CTX *mem_ctx, if (!tmp_ctx) return ENOMEM; /* Split the server list */ - ret = split_on_separator(tmp_ctx, servers, ',', true, &list, NULL); + ret = split_on_separator(tmp_ctx, servers, ',', true, true, &list, NULL); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to parse server list!\n")); goto done; diff --git a/src/providers/ipa/ipa_common.c b/src/providers/ipa/ipa_common.c index eb384a1f..be1bd1d2 100644 --- a/src/providers/ipa/ipa_common.c +++ b/src/providers/ipa/ipa_common.c @@ -770,7 +770,7 @@ errno_t ipa_servers_init(struct be_ctx *ctx, } /* split server parm into a list */ - ret = split_on_separator(tmp_ctx, servers, ',', true, &list, NULL); + ret = split_on_separator(tmp_ctx, servers, ',', true, true, &list, NULL); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to parse server list!\n")); goto done; diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c index ed2fffae..c6865c09 100644 --- a/src/providers/krb5/krb5_common.c +++ b/src/providers/krb5/krb5_common.c @@ -486,7 +486,7 @@ errno_t krb5_servers_init(struct be_ctx *ctx, return ENOMEM; } - ret = split_on_separator(tmp_ctx, servers, ',', true, &list, NULL); + ret = split_on_separator(tmp_ctx, servers, ',', true, true, &list, NULL); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to parse server list!\n")); goto done; diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c index f8b921ad..a97dc34e 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 52bd233f..807526b8 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 0a695cdb..f47e9865 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, |