Use REPLACE for attributes without equality matching - #1595
Open
arimu1 wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 asfacsimileTelephoneNumber(RFC 4519). RFC 2251 section 4.6 requires REPLACE of remaining values instead.NameAwareAttributenow 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
Fixes #1263
Closes gh-1263
Test plan
main(4b8ac9e5) forfacsimileTelephoneNumberremove-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