summaryrefslogtreecommitdiff
path: root/src/providers/ldap/ldap_id_enum.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2011-09-28 11:26:09 -0400
committerStephen Gallagher <sgallagh@redhat.com>2011-11-02 11:12:12 -0400
commit357efd33759fd1297723d9956a7f77226fe26871 (patch)
treee79696ada41330f3f78e45359bb4d404fd62170e /src/providers/ldap/ldap_id_enum.c
parent74a7d5805499a95a868ab4f43f77d34ccf9854a3 (diff)
downloadsssd-357efd33759fd1297723d9956a7f77226fe26871.tar.gz
sssd-357efd33759fd1297723d9956a7f77226fe26871.tar.bz2
sssd-357efd33759fd1297723d9956a7f77226fe26871.zip
LDAP: Convert ldap_*_search_filter
Instead of making this a global option for all user lookups, make it only used if the search base is passed without an explicit filter.
Diffstat (limited to 'src/providers/ldap/ldap_id_enum.c')
-rw-r--r--src/providers/ldap/ldap_id_enum.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/providers/ldap/ldap_id_enum.c b/src/providers/ldap/ldap_id_enum.c
index d49b64dd..45f4ef78 100644
--- a/src/providers/ldap/ldap_id_enum.c
+++ b/src/providers/ldap/ldap_id_enum.c
@@ -429,7 +429,6 @@ static struct tevent_req *enum_users_send(TALLOC_CTX *memctx,
{
struct tevent_req *req, *subreq;
struct enum_users_state *state;
- char *base_filter;
int ret;
req = tevent_req_create(memctx, &state, struct enum_users_state);
@@ -440,7 +439,7 @@ static struct tevent_req *enum_users_send(TALLOC_CTX *memctx,
state->op = op;
if (ctx->srv_opts && ctx->srv_opts->max_user_value && !purge) {
- base_filter = talloc_asprintf(
+ state->filter = talloc_asprintf(
state,
"(&(objectclass=%s)(%s=*)(%s=*)(%s=*)(%s>=%s)(!(%s=%s)))",
ctx->opts->user_map[SDAP_OC_USER].name,
@@ -452,7 +451,7 @@ static struct tevent_req *enum_users_send(TALLOC_CTX *memctx,
ctx->opts->user_map[SDAP_AT_USER_USN].name,
ctx->srv_opts->max_user_value);
} else {
- base_filter = talloc_asprintf(
+ state->filter = talloc_asprintf(
state,
"(&(objectclass=%s)(%s=*)(%s=*)(%s=*))",
ctx->opts->user_map[SDAP_OC_USER].name,
@@ -460,17 +459,8 @@ static struct tevent_req *enum_users_send(TALLOC_CTX *memctx,
ctx->opts->user_map[SDAP_AT_USER_UID].name,
ctx->opts->user_map[SDAP_AT_USER_GID].name);
}
- if (!base_filter) {
- DEBUG(2, ("Failed to build base filter\n"));
- ret = ENOMEM;
- goto fail;
- }
-
- state->filter = sdap_get_id_specific_filter(state, base_filter,
- dp_opt_get_string(ctx->opts->basic, SDAP_USER_SEARCH_FILTER));
- talloc_zfree(base_filter);
if (!state->filter) {
- DEBUG(2, ("Failed to build user filter\n"));
+ DEBUG(2, ("Failed to build base filter\n"));
ret = ENOMEM;
goto fail;
}
@@ -563,7 +553,6 @@ static struct tevent_req *enum_groups_send(TALLOC_CTX *memctx,
{
struct tevent_req *req, *subreq;
struct enum_groups_state *state;
- char *base_filter;
int ret;
req = tevent_req_create(memctx, &state, struct enum_groups_state);
@@ -574,7 +563,7 @@ static struct tevent_req *enum_groups_send(TALLOC_CTX *memctx,
state->op = op;
if (ctx->srv_opts && ctx->srv_opts->max_group_value && !purge) {
- base_filter = talloc_asprintf(
+ state->filter = talloc_asprintf(
state,
"(&(objectclass=%s)(%s=*)(&(%s=*)(!(%s=0)))(%s>=%s)(!(%s=%s)))",
ctx->opts->group_map[SDAP_OC_GROUP].name,
@@ -586,7 +575,7 @@ static struct tevent_req *enum_groups_send(TALLOC_CTX *memctx,
ctx->opts->group_map[SDAP_AT_GROUP_USN].name,
ctx->srv_opts->max_group_value);
} else {
- base_filter = talloc_asprintf(
+ state->filter = talloc_asprintf(
state,
"(&(objectclass=%s)(%s=*)(&(%s=*)(!(%s=0))))",
ctx->opts->group_map[SDAP_OC_GROUP].name,
@@ -594,17 +583,8 @@ static struct tevent_req *enum_groups_send(TALLOC_CTX *memctx,
ctx->opts->group_map[SDAP_AT_GROUP_GID].name,
ctx->opts->group_map[SDAP_AT_GROUP_GID].name);
}
- if (!base_filter) {
- DEBUG(2, ("Failed to build filter\n"));
- ret = ENOMEM;
- goto fail;
- }
-
- state->filter = sdap_get_id_specific_filter(state, base_filter,
- dp_opt_get_string(ctx->opts->basic, SDAP_GROUP_SEARCH_FILTER));
- talloc_zfree(base_filter);
if (!state->filter) {
- DEBUG(2, ("Failed to build group filter\n"));
+ DEBUG(2, ("Failed to build filter\n"));
ret = ENOMEM;
goto fail;
}