#3567 SYSDB: Lowercased email is stored as nameAlias

Created 8 months ago by mzidek
Modified 6 months ago

SSSD does support lookup of users by email address. We store the email address from LDAP twice in the sysdb database.

Once in the 'email' attribute in the original case and once in the 'nameAlias' attribute in lowercased form.

Probably the reason why we use the 'nameAlias' is for performance reasons (we probably wanted to return it in the sysdb_getpwnam search and do not wait for the search by UPN), but it should be investigated further if this was really the case.

Storing emails as nameAlias is not intuitive and does not allow us to search for just the name (and not email address). It may be beneficial to store the lowercased email address in attribute that is called for example 'lowercasedEmail', 'lcEmail' or 'emailAlias'.

Following things should be considered when solving this issue:
- cache version will need to be increased and cache update function implemented
- we need to decide when we want to search by the email address - if we want to return it also in the sysdb_getpwnam call or not

This issue was raised during review of this PR: https://github.com/SSSD/sssd/pull/432
which is related to issue: https://pagure.io/SSSD/sssd/issue/3293

Note: we will not be able to avoid conflicts if several users share the same email address, but if we decide to not search by email during the sysdb_getpwnam call the debug message from the above PR may be moved to a different function.

JFYI, this commit which adds the email to the name aliases is 9a31091 and as the commit message says it was added to speed up lookups without being aware of the side-effects. I think it can just be reverted. If it is reverted the commit 04d4c4d which adds a helper call can be reverted as well.

I think it is not needed to store the lower-cased email in another attribute but the 'mail' attribute can be made CASE_INSENSITIVE in @ATTRIBUTES in src/db/sysdb_private.h.

8 months ago

Metadata Update from @mzidek:
- Issue assigned to mzidek

8 months ago

Metadata Update from @jhrozek:
- Issue priority set to: minor
- Issue set to the milestone: SSSD 1.16.1
- Issue tagged with: refactoring

7 months ago

Metadata Update from @jhrozek:
- Issue tagged with: postpone-to-2-0

6 months ago

Metadata Update from @jhrozek:
- Issue untagged with: postpone-to-2-0
- Issue set to the milestone: SSSD 2.0 (was: SSSD 1.16.1)

Login to comment on this ticket.

cancel