diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2012-02-22 21:18:48 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-02-23 09:13:21 -0500 |
commit | 087219897d8b8a92d7d33da3fa30883d40ad8cdb (patch) | |
tree | 5f003f8861d653ca4aabcba8570196861c31b9c5 /src/providers/ipa | |
parent | 5319ad03a11fb600bea9a9a51a392eef38e10ac8 (diff) | |
download | sssd-087219897d8b8a92d7d33da3fa30883d40ad8cdb.tar.gz sssd-087219897d8b8a92d7d33da3fa30883d40ad8cdb.tar.bz2 sssd-087219897d8b8a92d7d33da3fa30883d40ad8cdb.zip |
IPA: Add ipa_parse_search_base()
Previously, we were using sdap_parse_search_base() for setting up
the search_base objects for use in IPA. However, this was
generating unfriendly log messages about unknown search base
types. This patch creates a new common_parse_search_base() routine
that can be used with either LDAP or IPA providers.
https://fedorahosted.org/sssd/ticket/1151
Diffstat (limited to 'src/providers/ipa')
-rw-r--r-- | src/providers/ipa/ipa_common.c | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/src/providers/ipa/ipa_common.c b/src/providers/ipa/ipa_common.c index 4fd44836..8307f6ab 100644 --- a/src/providers/ipa/ipa_common.c +++ b/src/providers/ipa/ipa_common.c @@ -327,6 +327,41 @@ done: return ret; } +static errno_t ipa_parse_search_base(TALLOC_CTX *mem_ctx, + struct dp_option *opts, int class, + struct sdap_search_base ***_search_bases) +{ + const char *class_name; + char *unparsed_base; + + *_search_bases = NULL; + + switch (class) { + case IPA_HBAC_SEARCH_BASE: + class_name = "IPA_HBAC"; + break; + case IPA_HOST_SEARCH_BASE: + class_name = "IPA_HOST"; + break; + case IPA_SELINUX_SEARCH_BASE: + class_name = "IPA_SELINUX"; + break; + default: + DEBUG(SSSDBG_CONF_SETTINGS, + ("Unknown search base type: [%d]\n", class)); + class_name = "UNKNOWN"; + /* Non-fatal */ + break; + } + + unparsed_base = dp_opt_get_string(opts, class); + if (!unparsed_base || unparsed_base[0] == '\0') return ENOENT; + + return common_parse_search_base(mem_ctx, unparsed_base, + class_name, NULL, + _search_bases); +} + int ipa_get_id_options(struct ipa_options *ipa_opts, struct confdb_ctx *cdb, const char *conf_path, @@ -584,9 +619,9 @@ int ipa_get_id_options(struct ipa_options *ipa_opts, dp_opt_get_string(ipa_opts->basic, IPA_HOST_SEARCH_BASE))); } - ret = sdap_parse_search_base(ipa_opts->basic, ipa_opts->basic, - IPA_HOST_SEARCH_BASE, - &ipa_opts->host_search_bases); + ret = ipa_parse_search_base(ipa_opts->basic, ipa_opts->basic, + IPA_HOST_SEARCH_BASE, + &ipa_opts->host_search_bases); if (ret != EOK) goto done; if (NULL == dp_opt_get_string(ipa_opts->basic, @@ -607,9 +642,9 @@ int ipa_get_id_options(struct ipa_options *ipa_opts, dp_opt_get_string(ipa_opts->basic, IPA_HBAC_SEARCH_BASE))); } - ret = sdap_parse_search_base(ipa_opts->basic, ipa_opts->basic, - IPA_HBAC_SEARCH_BASE, - &ipa_opts->hbac_search_bases); + ret = ipa_parse_search_base(ipa_opts->basic, ipa_opts->basic, + IPA_HBAC_SEARCH_BASE, + &ipa_opts->hbac_search_bases); if (ret != EOK) goto done; if (NULL == dp_opt_get_string(ipa_opts->basic, @@ -630,9 +665,9 @@ int ipa_get_id_options(struct ipa_options *ipa_opts, dp_opt_get_string(ipa_opts->basic, IPA_SELINUX_SEARCH_BASE))); } - ret = sdap_parse_search_base(ipa_opts->basic, ipa_opts->basic, - IPA_SELINUX_SEARCH_BASE, - &ipa_opts->selinux_search_bases); + ret = ipa_parse_search_base(ipa_opts->basic, ipa_opts->basic, + IPA_SELINUX_SEARCH_BASE, + &ipa_opts->selinux_search_bases); if (ret != EOK) goto done; value = dp_opt_get_string(ipa_opts->id->basic, SDAP_DEREF); |