Skip to content

Honor ldap filters#8534

Open
ondrejv2 wants to merge 1 commit intoSSSD:masterfrom
ondrejv2:test
Open

Honor ldap filters#8534
ondrejv2 wants to merge 1 commit intoSSSD:masterfrom
ondrejv2:test

Conversation

@ondrejv2
Copy link
Contributor

fixes bug #8533

@gemini-code-assist
Copy link

Warning

Gemini is experiencing higher than usual traffic and was unable to create the review. Please try again in a few hours by commenting /gemini review.

@ondrejv2
Copy link
Contributor Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses bug #8533 by adding a check to filter out entries in sdap_nested_group_lookup_recv based on their type, ensuring that only entries matching the expected type are processed. This change prevents incorrect entries from being included in nested group lookups.

Comment on lines +2031 to +2039
if (*_type != SDAP_NESTED_GROUP_DN_UNKNOWN && state->member_type != *_type)
{
/* this entry needs to be filtered out */
*_entry = NULL;
*_type = SDAP_NESTED_GROUP_DN_IGNORE;
} else {
*_entry = talloc_steal(mem_ctx, state->member);
*_type = state->member_type;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This conditional block introduces a check that filters entries based on *_type and state->member_type. If the types don't match (and *_type is not SDAP_NESTED_GROUP_DN_UNKNOWN), the entry is explicitly set to NULL and the type is set to SDAP_NESTED_GROUP_DN_IGNORE. This logic is intended to filter out entries that do not match the expected type during nested group lookups. However, setting *_entry to NULL might lead to unexpected behavior if the caller expects a valid pointer, even for ignored entries. It would be safer to avoid processing the entry altogether instead of setting it to NULL.

       return EOK;
    }

    if (*_type != SDAP_NESTED_GROUP_DN_UNKNOWN && state->member_type != *_type)
       {
         /* this entry needs to be filtered out */
         *_type = SDAP_NESTED_GROUP_DN_IGNORE;
         return EOK; // Exit early, avoiding further processing
       } else {
         *_entry = talloc_steal(mem_ctx, state->member);
         *_type = state->member_type;
       }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants