Skip to content

Commit ea29407

Browse files
ondrejv2alexey-tikhonov
authored andcommitted
Honor ldap filters
Reviewed-by: Alexey Tikhonov <atikhono@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com> (cherry picked from commit 96d3823)
1 parent fa4f7ed commit ea29407

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/providers/ldap/sdap_async_nested_groups.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static errno_t
123123
sdap_nested_group_lookup_recv(TALLOC_CTX *mem_ctx,
124124
struct tevent_req *req,
125125
struct sysdb_attrs **_entry,
126-
enum sdap_nested_group_dn_type *_type);
126+
enum sdap_nested_group_dn_type *type);
127127

128128
static struct tevent_req *
129129
sdap_nested_group_deref_send(TALLOC_CTX *mem_ctx,
@@ -1566,8 +1566,10 @@ sdap_nested_group_single_step_process(struct tevent_req *subreq)
15661566
break;
15671567

15681568
case SDAP_NESTED_GROUP_DN_IGNORE:
1569-
/* Mapping was found but required attribute is missing */
1570-
DEBUG(SSSDBG_TRACE_FUNC, "Ignoring [%s] because of missing attributes\n",
1569+
/* Mapping was found but required attribute is missing or entry filtered out
1570+
* intentionally */
1571+
DEBUG(SSSDBG_TRACE_FUNC, "Ignoring [%s] because of missing attributes "
1572+
"or entry filtered out\n",
15711573
state->current_member->dn);
15721574
break;
15731575

@@ -2010,7 +2012,7 @@ static errno_t
20102012
sdap_nested_group_lookup_recv(TALLOC_CTX *mem_ctx,
20112013
struct tevent_req *req,
20122014
struct sysdb_attrs **_entry,
2013-
enum sdap_nested_group_dn_type *_type)
2015+
enum sdap_nested_group_dn_type *type)
20142016
{
20152017
const char *val = NULL;
20162018
errno_t ret = EOK;
@@ -2023,18 +2025,25 @@ sdap_nested_group_lookup_recv(TALLOC_CTX *mem_ctx,
20232025
TEVENT_REQ_RETURN_ON_ERROR(req);
20242026

20252027
if (state->member == NULL) {
2026-
*_type = SDAP_NESTED_GROUP_DN_UNKNOWN;
2028+
*type = SDAP_NESTED_GROUP_DN_UNKNOWN;
20272029
*_entry = NULL;
20282030
return EOK;
20292031
}
20302032

2031-
*_entry = talloc_steal(mem_ctx, state->member);
2032-
*_type = state->member_type;
2033+
if (*type != SDAP_NESTED_GROUP_DN_UNKNOWN && state->member_type != *type) {
2034+
/* filtered out by the "ldap_*_search_base" parameters */
2035+
*_entry = NULL;
2036+
*type = SDAP_NESTED_GROUP_DN_IGNORE;
2037+
} else {
2038+
*_entry = talloc_steal(mem_ctx, state->member);
2039+
*type = state->member_type;
2040+
}
2041+
20332042
if (DEBUG_IS_SET(SSSDBG_TRACE_ALL)) {
20342043
if (sysdb_attrs_get_string(state->member, SYSDB_ORIG_DN, &val) != EOK) {
20352044
val = "- DN not available -";
20362045
}
2037-
switch (state->member_type) {
2046+
switch (*type) {
20382047
case SDAP_NESTED_GROUP_DN_USER:
20392048
DEBUG(SSSDBG_TRACE_ALL, "%s is User\n", val);
20402049
break;

0 commit comments

Comments
 (0)