Skip to content

getModificationItems() produces wrong results for attributes without an equality matching rule #1263

@lpeter91

Description

@lpeter91

Spring LDAP version: 3.3.4

DirContextAdapter's getModificationItems() assumes that for partial modifications of multivalued attributes it can remove values individually. This is fine in most of the cases, however it does not work for attributes without an "equality matching rule". (At least in strict Directory implementations like OpenLDAP.)

For example facsimileTelephoneNumber is such an attribute (See schema def without matching rule in RFC4519). If it has 2 values, and I want to remove one, getModificationItems() will generate a single "removal by value" operation, which will fail with the error message "facsimileTelephoneNumber: no equality matching rule". The correct course of action would be to replace the attribute in its entirety, as per RFC2251:

If an equality match filter has not been defined for an attribute type, clients MUST NOT attempt to delete individual values of that attribute from an entry using the "delete" form of a modification, and MUST instead use the "replace" form.

I think the presence (or lack) of an equality matching rule could be extracted from the schema into a bool in NameAwareAttribute, similar to orderMatters. (However I can see that NameAwareAttribute does not currently support the schema methods, and also not sure whether the implementation originally passed to its constructor does, and that adding support only from that constructor would be even sufficient.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions