Skip to content

Use REPLACE for attributes without equality matching - #1595

Open
arimu1 wants to merge 1 commit into
spring-projects:mainfrom
arimu1:gh-1263
Open

Use REPLACE for attributes without equality matching#1595
arimu1 wants to merge 1 commit into
spring-projects:mainfrom
arimu1:gh-1263

Conversation

@arimu1

@arimu1 arimu1 commented Aug 17, 2026

Copy link
Copy Markdown

DirContextAdapter.getModificationItems() used REMOVE-by-value for partial updates of multi-valued attributes. That fails on strict directories (for example OpenLDAP) for types without an equality matching rule such as facsimileTelephoneNumber (RFC 4519). RFC 2251 section 4.6 requires REPLACE of remaining values instead.

NameAwareAttribute now records whether equality matching is defined (RFC 4519 types without it, plus an explicit constructor). Ordered attributes and types without equality matching are replaced in full; attributes with equality matching keep per-value ADD/REMOVE.

Summary

  • REPLACE remaining values when an attribute has no equality matching rule
  • Preserve REMOVE-by-value when equality matching is defined

Fixes #1263
Closes gh-1263

Test plan

  • Proved FAIL on main (4b8ac9e5) for facsimileTelephoneNumber remove-one-of-two (REMOVE-by-value)
  • ./gradlew :spring-ldap-core:test --tests org.springframework.ldap.core.DirContextAdapterTests --tests org.springframework.ldap.core.DirContextAdapterBugTests --tests org.springframework.ldap.core.NameAwareAttributeTests --tests org.springframework.ldap.core.NameAwareAttributesTests (JDK 21)
  • ./gradlew :spring-ldap-core:checkstyleMain :spring-ldap-core:checkstyleTest :spring-ldap-core:checkFormat

RFC 2251 section 4.6 forbids deleting individual values of attributes
without an equality matching rule. Collect remaining values with
REPLACE instead of REMOVE-by-value.

Closes spring-projectsgh-1263

Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant