From 9db6f65a8536781f6bca20ff8031de18c0f79397 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Tue, 10 Sep 2019 18:02:17 +0300 Subject: [PATCH] Allow presence of LDAP attribute options LDAP attribute options aren't enforced in the LDAP schema. They represent server- and client-side treatment of attribute values but the schema definition knows nothing about them. When we check attribute presence in the entry, we should strip options before comparing attribute names with the schema. Related: https://pagure.io/freeipa/issue/8001 Signed-off-by: Alexander Bokovoy Reviewed-By: Alexander Bokovoy Reviewed-By: Rob Crittenden Reviewed-By: Florence Blanc-Renaud --- ipaserver/plugins/baseldap.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ipaserver/plugins/baseldap.py b/ipaserver/plugins/baseldap.py index 298f12ec1..7c6581ed5 100644 --- a/ipaserver/plugins/baseldap.py +++ b/ipaserver/plugins/baseldap.py @@ -854,7 +854,11 @@ def _check_limit_object_class(attributes, attrs, allow_only): """ if len(attributes[0]) == 0 and len(attributes[1]) == 0: return - limitattrs = deepcopy(attrs) + # Remove options from the attributes names before validating + # LDAP schema does not enforce any of LDAP attribute options + # (e.g. attribute;option), thus we should avoid comparing + # attribute names with options directly. + limitattrs = [x.split(';')[0] for x in attrs] # Go through the MUST first for attr in attributes[0].values(): if attr.names[0].lower() in limitattrs: