]> git.proxmox.com Git - pve-access-control.git/commit
LDAP sync: improve validation of synced attributes
authorFiona Ebner <f.ebner@proxmox.com>
Thu, 8 Feb 2024 09:45:40 +0000 (10:45 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 8 Feb 2024 17:54:10 +0000 (18:54 +0100)
commit92ab209ab5c19fae48ec807b5566376eae89d7ba
tree2f84b040cf7a0c587401ad572e6a623b7114098f
parent42476f0f65550d71ab668360a799eecdfcb23bc2
LDAP sync: improve validation of synced attributes

and skip the ones not fitting our schema, while warning the user about
them.

Also warns the user if the specified 'sync_attributes' mapping
contains entries for attributes that don't exist, e.g.
'enabled=active' (since the property on PVE side is called 'enable').

For the 'enable' property, any value coming from the server led to the
user being enabled, even "0", because it is a string. This is not
changed by this patch, by not trying to validate or parse a boolean.

In get_users(), the username is also set in the returned hash, but
without the realm. This doesn't seem to be necessary for syncing,
because the username with the realm is used as a hash key and that's
what's relied upon when updating the config. But the tests require it
to be set, so that is not changed by this patch either.

Relies on the user properties (other than username) to be standard
options called 'user-XYZ'. Could be improved by moving the schema for
user properties from the API module to a module that can be accessed
by both API and plugin here and creating a helper for accessing it.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
(cherry picked from commit cb93636b55c26f641fdbedef10dbb6e80b4502b8)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Auth/LDAP.pm