-
-
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
Compare lowercase email when updating from ldap #33813
Conversation
1115490
to
b96c8fe
Compare
If the email already is being received lowercase it should also stay lower case. I would not know why or where this change would happen. The fix will surely work, however I am not sure this is should be necessary, when the issue might be elsewhere. Could you reproduce this behaviour? |
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.
Maybe instead fix setEMailAddress to correctly handle this usecase?
Either we support storing uppercase email and we should be able to update it. Or we do not and it should be ensured by the system.
b96c8fe
to
e184d57
Compare
My first analysis was wrong, I update the first comment, please review again, and thanks for the feedbacks :) |
/backport to stable24 |
/backport to stable23 |
/backport to stable22 |
CI failure look unrelated |
/rebase |
Just to be sure ^ |
…though. - LDAP has an email address with capital letters - NC store this address in lower case - When the user logs in, we compare the [stored email with the new lower case email](https://github.com/nextcloud/server/blob/master/lib/private/AllConfig.php#L259-L261) before storing it. Here, both email will be the same, so we won't store the new email address with upper case letters. Which is what we want. - We then [compare emails as they are before triggering an event](https://github.com/nextcloud/server/blob/master/lib/private/User/User.php#L202-L204), they won't match, so the user will receive an email signaling an email change every time he logs in. The fix is to compare the old email with the new lower case email before sending the event. Signed-off-by: Louis Chemineau <louis@chmn.me>
e184d57
to
6c11944
Compare
Otherwise we detect a email change all the time and since email are immutable in ldap this prevent updating other fields. Related: #33813 Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Otherwise we detect a email change all the time and since email are immutable in ldap this prevent updating other fields. Related: #33813 Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Otherwise we detect a email change all the time and since email are immutable in ldap this prevent updating other fields. Related: #33813 Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Otherwise we detect a email change all the time and since email are immutable in ldap this prevent updating other fields. Related: #33813 Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Otherwise we detect a email change all the time and since email are immutable in ldap this prevent updating other fields. Related: #33813 Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Otherwise we detect a email change all the time and since email are immutable in ldap this prevent updating other fields. Related: nextcloud#33813 Signed-off-by: Carl Schwan <carl@carlschwan.eu>
The backports for 23 and 24 are still missing because they were reverted in the past: |
/backport to stable23 |
/backport to stable24 |
Otherwise we detect a email change all the time and since email are immutable in ldap this prevent updating other fields. Related: nextcloud/server#33813 Signed-off-by: Carl Schwan <carl@carlschwan.eu>
I dug into it again, and the issue is much simpler than I previously though.
The fix is to compare the old email with the new lower case email before sending the event.
Scenario:- Nextcloud has an email with capital letters for a user. No idea why, as it seems we are storing it in lowercases.- LDAP has the same email address.- The user log in, callingprocessAttributes
, which callupdateEmail
, which compare emails as they are stored ($currentEmail !== $email
)- But when we are about to update the email, we once again check old and new values, but this time we lower case the new valueThis means that Nextcloud will try to update the email again and again because we compare an address email with its lower case equivalent. Remember that Nextcloud has an email with capital letter in its database.So the user will receive a continuous stream of email signaling an email change as we later compare email as they are before triggering the event.