-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: fix inGroup for memberUid type of group memberships #24402
Conversation
Signed-off-by: Arthur Schiwon <[email protected]>
@blizzz - I think you also need to consider server/apps/user_ldap/lib/Group_LDAP.php Line 112 in 57bfe0d
I've not checked whether server/apps/user_ldap/lib/Group_LDAP.php Line 119 in 57bfe0d
|
I just ran a few tests and you change makes total sense... now $members really contains dns so the in_array check works. server/apps/user_ldap/lib/Group_LDAP.php Line 160 in 57bfe0d
because then $dns is already filled but ins this form:
and now the array_reduce part might or might not be run (depending if there are filterParts left) TLDR: I committed my changes to this branch... I hope this is okay? (and the proper way?) I'm also thinking, that a foreach for cleaning up the array would be better to understand than the array_reduce. we could replace:
with a simple:
also should we could (should?) move: server/apps/user_ldap/lib/Group_LDAP.php Lines 139 to 141 in 57bfe0d
after the switch statement |
also added some additional comments and renamed some vars to make it intuitive whats in them Signed-off-by: Tobias Perschon <[email protected]>
578f5f9
to
594370e
Compare
is it possible that this was old information, perhaps pulled it from caching? Since it really only is assigned the value of |
Signed-off-by: Arthur Schiwon <[email protected]>
@tofuSCHNITZEL good catch with the loop! Also thanks for the commit, that's appreciated. I'd build upon it and turn the last array_reduce to an unsexy, but less hungry and more performant foreach (like you suggest). I'd still work with having the DN as index, as it saves in_arrays and prevents potential duplicates. Moving the count check down makes sense as well. And dropping the is_array check with it since it is guaranteed by the return type. |
- the type check is not necessary anymore for the return type of _groupMembers() Signed-off-by: Arthur Schiwon <[email protected]>
great ;) should / will this fix be backported to 19 or even earlier? I guess sind its not a huge change we should/could do it. the structure of the file is a bit different pre v20 because of my changes to it for the zimbra support so I could port the changes to the v19 GroupLDAP file. |
Signed-off-by: Arthur Schiwon <[email protected]>
…and added unit tests.
Yes, it is a bug fix, and should be brought back down to 18. If we need to touch a bit there, so be it :) |
Signed-off-by: Arthur Schiwon <[email protected]>
Of course, It is very well possible that this old information came from caching. We encountered the problem on two servers, but only one of them is actually running using a cache. And only on this server, the if clause, where line 112 resides, was entered, and only there I needed the fix. I haven't done further testing, but maybe emptying the cache would have also helped (after fixing it at the right place where the cache gets filled). |
Sorry, I was too busy at work to test the last proposal. |
I think, since dn is such an integral attribute to ldap, it will always be a part of a ldap query response. |
Yes, it always returns the dn as it is the de-facto (current!) identifier, even if you ask for a single different attribute:
|
🤖 beep boop beep 🤖 Here are the logs for the failed build: Status of 36131: failuremariadb10.1-php7.3Show full log
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 🐘
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
/backport to stable20 |
/backport to stable19 |
The backport to stable19 failed. Please do this backport manually. |
@blizzz how will we do the stable19 backport? will we create a new branch and do the changes there manually? on what commit will this branch be based? |
Yes, we should do it. It's somewhere deep in my list, but if you want to beat me, that would be really appreciated :) A branch called |
okay tried my best ;) hopefully I did everything how its supposed to be done ;) |
fixes #24252
basically, the code that resolves the rdns to full DNs returned the whole records, as @Hexasoft observed, but the following code requires a flat list of DNs.
@Hexasoft @steffen-moser can you confirm it fixes the issue for you?
@tofuSCHNITZEL you are informed because it is relevant for zimbramailforwardingaddress types, I would be surprised if it breaks anything though.
It set the label to "developing", because i want to check one, two things tomorrow.