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/ldap/ldap_common.c | |
parent | 5319ad03a11fb600bea9a9a51a392eef38e10ac8 (diff) | |
download | sssd-087219897d8b8a92d7d33da3fa30883d40ad8cdb.tar.gz sssd-087219897d8b8a92d7d33da3fa30883d40ad8cdb.tar.xz 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/ldap/ldap_common.c')
-rw-r--r-- | src/providers/ldap/ldap_common.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c index cec3989d0..3b6a1b2ba 100644 --- a/src/providers/ldap/ldap_common.c +++ b/src/providers/ldap/ldap_common.c @@ -706,19 +706,9 @@ errno_t sdap_parse_search_base(TALLOC_CTX *mem_ctx, struct dp_option *opts, int class, struct sdap_search_base ***_search_bases) { - errno_t ret; - struct sdap_search_base **search_bases; - TALLOC_CTX *tmp_ctx; - struct ldb_context *ldb; - struct ldb_dn *ldn; - struct ldb_parse_tree *tree; const char *class_name; char *unparsed_base; - char **split_bases; - char *filter; const char *old_filter = NULL; - int count; - int i, c; *_search_bases = NULL; @@ -751,11 +741,34 @@ errno_t sdap_parse_search_base(TALLOC_CTX *mem_ctx, ("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, old_filter, + _search_bases); +} + +errno_t common_parse_search_base(TALLOC_CTX *mem_ctx, + const char *unparsed_base, + const char *class_name, + const char *old_filter, + struct sdap_search_base ***_search_bases) +{ + errno_t ret; + struct sdap_search_base **search_bases; + TALLOC_CTX *tmp_ctx; + struct ldb_context *ldb; + struct ldb_dn *ldn; + struct ldb_parse_tree *tree; + char **split_bases; + char *filter; + int count; + int i, c; + tmp_ctx = talloc_new(NULL); if (!tmp_ctx) { ret = ENOMEM; |