Fix ExtendedRequest requestValue RFC4511 encoding - #629
Closed
michele-deluca wants to merge 1 commit into
Closed
michele-deluca wants to merge 1 commit into
michele-deluca wants to merge 1 commit into
Conversation
Member
|
Fixed in #628 with tests. Needs overall work done. |
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.
Problem
RFC 4511 defines ExtendedRequest as:
ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
requestName [0] LDAPOID,
requestValue [1] OCTET STRING OPTIONAL
}
The current implementation appends er.Value directly as a child of the ExtendedRequest:
if er.Value != nil {
pkt.AppendChild(er.Value)
}
ExtendedRequest
├─ requestName [0]
└─ SEQUENCE {...}
ExtendedRequest
├─ requestName [0]
└─ requestValue [1] OCTET STRING
This breaks interoperability with LDAP extensions expecting RFC-compliant encoding.
One example is the eDirectory NMAS Universal Password extension (OID 2.16.840.1.113719.1.39.42.100.13), which returns:
NMAS Extension invalid version
with the current implementation.
Fix
Serialize er.Value and encode it as the context-specific [1] requestValue field defined by RFC 4511.
Validation
Validated against eDirectory/OpenLDAP interoperability tests.
Before patch:
NMAS Extension invalid version
SEQUENCE {
INTEGER 1
INTEGER 0
OCTET STRING ""
}