Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDAP filter containing 'or' query not correctly recogonized #11991

Open
2 tasks done
RKO1337 opened this issue Oct 18, 2022 · 3 comments
Open
2 tasks done

LDAP filter containing 'or' query not correctly recogonized #11991

RKO1337 opened this issue Oct 18, 2022 · 3 comments
Assignees

Comments

@RKO1337
Copy link

RKO1337 commented Oct 18, 2022

Debug mode

Describe the bug

We use a LDAP filter with an 'or' query which filters for two groups.
When using the filter the warning "This value should probably not be wrapped in parentheses." is displayed.

Reproduction steps

  1. Use LDAP filter (|(memberof=cn=staff,ou=groups,dc=xxxxx,dc=xx)(memberof=cn=almost-staff,ou=groups,dc=xxxx,dc=xx))
  2. Try "Test LDAP Login" ldap_search(): Search: Bad search filter is displayed
    ...

Expected behavior

Users of groups "staff" and "almost-staff" are able to login.

Screenshots

No response

Snipe-IT Version

v6.0.12-alpine

Operating System

alpine

Web Server

httpd provided in Docker image

PHP Version

PHP 7.4.26

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

@welcome
Copy link

welcome bot commented Oct 18, 2022

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@uberbrady uberbrady self-assigned this Nov 2, 2022
@uberbrady
Copy link
Collaborator

Try something like:

&(|(memberof=cn=staff,ou=groups,dc=xxxxx,dc=xx)(memberof=cn=almost-staff,ou=groups,dc=xxxx,dc=xx))

The auth query will get appended to the LDAP filter, so you'll need that 'and' there. The parentheses then give you a subquery that's the 'OR' query that you're looking for.

@RKO1337
Copy link
Author

RKO1337 commented Nov 3, 2022

I created two users: itam-staff (member of group staff) and itam-almost-staff (member of group almost-staff).

Only itam-staff is able to login with your provided LDAP Filter.
Both users are synced to SnipeIT.
image

Test LDAP Login itam-staff
image

Test LDAP Login itam-almost-staff
image

I added the user itam-almost-staff to the group staff for testing. I was able to login as the user, and the Test LDAP Login in the LDAP configuration page worked.

When the user itam-almost-staff is removed from the group staff the user is still able to login, but the Test LDAP Login in the LDAP configuration page is failing.

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

No branches or pull requests

2 participants