lsc icon indicating copy to clipboard operation
lsc copied to clipboard

Trigger MODRDN operation if RDN case has changed

Open soisik opened this issue 3 years ago • 4 comments

When checking if an entry should be renamed, LSC compare the destination DN with the source DN ignoring the case. See https://github.com/lsc-project/lsc/blob/v2.1/src/main/java/org/lsc/beans/BeanComparator.java#L129.

If it's a good thing to ignore case for the attribute names or branch part (CN=/cn= or OU=LOCAL/ou=local...) that are not sensitive to case in directories, it is not always true for the RDN part, for example using the CN attribute (eg. "cn=DOE John" vs "cn=Doe John" are different)

It would be nice to have an option to tell LSC to compare DN's RDN in a case sensitive way when checking if an entry should be renamed. It could be made the default behavior in 2.2.

soisik avatar Mar 08 '22 15:03 soisik

Actually, it's up to the schema to decide wether the attribute must or must not be case insensitive. Some attributes use "case insensitive" comparison rules, other "case sensitive".

It's a bit overkill to let the LSC load the schema and determine the rules, but maybe could we define in lsc.xml some static configuration, for example:

<comparisonRules>
  <cn>caseInsensitive</cn>
  <uid>caseInsensitive</uid>
  ...
</comparisonRules>

davidcoutadeur avatar Mar 08 '22 15:03 davidcoutadeur

By the way, the comparison rule for cn is caseIgnoreMatch, so "cn=DOE John" should be equal to "cn=Doe John"

davidcoutadeur avatar Mar 08 '22 15:03 davidcoutadeur

See also #54

coudot avatar Mar 08 '22 16:03 coudot

It's a bit overkill to let the LSC load the schema and determine the rules

Modern LDAP libraries such as Apache Directory's one allow to load the schema from the LDAP directory and to have a schema-aware DN comparison. We could try this.

rouazana avatar Mar 19 '22 23:03 rouazana