Skip to content

strip surrounding spaces before hexstring form in DN value - #606

Open
netliomax25-code wants to merge 1 commit into
go-ldap:masterfrom
netliomax25-code:dn-hexstring-strip-spaces
Open

strip surrounding spaces before hexstring form in DN value#606
netliomax25-code wants to merge 1 commit into
go-ldap:masterfrom
netliomax25-code:dn-hexstring-strip-spaces

Conversation

@netliomax25-code

Copy link
Copy Markdown
Contributor
  1. setValue detects the RFC 4514 hexstring value form by testing the raw value for a leading # and hex-decodes it before any space stripping, but the string form is stripped of insignificant leading and trailing spaces by decodeString.
  2. so a value written in the hexstring form with surrounding spaces is parsed inconsistently: O= #04024869 is read as the literal string #04024869 and O=#04024869 is rejected, while the canonical O=#04024869 decodes to the BER value Hi.
  3. the first two then compare unequal to the canonical form under DN.Equal/EqualFold (distinguishedNameMatch, used for identity comparisons), or a valid value fails to parse.

Strip the surrounding spaces before detecting and decoding the hexstring form, matching the string form and the existing CN = ... handling already covered in the parse tests. Added parse cases for the leading, trailing, and both-sides forms.

@netliomax25-code

Copy link
Copy Markdown
Contributor Author

gentle ping

@cpuschma cpuschma self-assigned this Jul 5, 2026
@cpuschma cpuschma added enhancement go Pull requests that update go code labels Jul 5, 2026
@cpuschma

cpuschma commented Jul 5, 2026

Copy link
Copy Markdown
Member

@netliomax25-code Thank you for your pull requests. I will take a look, but please note that we review and compare the proposed changes to the LDAP specification and the project guidelines in our free time, and we currently have a high number of pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants