diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2015-09-16 15:28:54 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-09-22 13:46:00 +0200 |
commit | cf66c53e46fad46f47489f43265c58004e0e39d4 (patch) | |
tree | e9f0988ce67fb4b524b00c44119287107199139f /src/providers/ldap/ldap_options.c | |
parent | cffe3defa3cb5011efc92a7773fe113a1e69774f (diff) | |
download | sssd-cf66c53e46fad46f47489f43265c58004e0e39d4.tar.gz sssd-cf66c53e46fad46f47489f43265c58004e0e39d4.tar.xz sssd-cf66c53e46fad46f47489f43265c58004e0e39d4.zip |
LDAP: Move sdap_create_search_base from ldap to sdap code
The function shouldn't be placed in the LDAP tree, but in the SDAP tree
to make it usable from tests without linking to libraries that are
normally linked from LDAP provider (such as confdb)
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/providers/ldap/ldap_options.c')
-rw-r--r-- | src/providers/ldap/ldap_options.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/providers/ldap/ldap_options.c b/src/providers/ldap/ldap_options.c index eb00aab3..7ad60715 100644 --- a/src/providers/ldap/ldap_options.c +++ b/src/providers/ldap/ldap_options.c @@ -532,69 +532,6 @@ errno_t sdap_parse_search_base(TALLOC_CTX *mem_ctx, _search_bases); } -errno_t -sdap_create_search_base(TALLOC_CTX *mem_ctx, - const char *unparsed_base, - int scope, - const char *filter, - struct sdap_search_base **_base) -{ - struct sdap_search_base *base; - TALLOC_CTX *tmp_ctx; - errno_t ret; - struct ldb_dn *ldn; - struct ldb_context *ldb; - - tmp_ctx = talloc_new(NULL); - if (!tmp_ctx) { - ret = ENOMEM; - goto done; - } - - /* Create a throwaway LDB context for validating the DN */ - ldb = ldb_init(tmp_ctx, NULL); - if (!ldb) { - ret = ENOMEM; - goto done; - } - - base = talloc_zero(tmp_ctx, struct sdap_search_base); - if (base == NULL) { - ret = ENOMEM; - goto done; - } - - base->basedn = talloc_strdup(base, unparsed_base); - if (base->basedn == NULL) { - ret = ENOMEM; - goto done; - } - - /* Validate the basedn */ - ldn = ldb_dn_new(tmp_ctx, ldb, unparsed_base); - if (!ldn) { - ret = ENOMEM; - goto done; - } - - if (!ldb_dn_validate(ldn)) { - DEBUG(SSSDBG_CRIT_FAILURE, - "Invalid base DN [%s]\n", - unparsed_base); - ret = EINVAL; - goto done; - } - - base->scope = scope; - base->filter = filter; - - *_base = talloc_steal(mem_ctx, base); - ret = EOK; -done: - talloc_free(tmp_ctx); - return ret; -} - errno_t common_parse_search_base(TALLOC_CTX *mem_ctx, const char *unparsed_base, const char *class_name, |