]> 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 10:50:03 +0000 (11:50 +0100)
commitcb93636b55c26f641fdbedef10dbb6e80b4502b8
tree3aa5a767d027a0ea0d9977fcdd4d590ebeb48fc4
parent2dabf3c3ae387b571a33b38e6960a89af495ff40
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>
src/PVE/Auth/LDAP.pm