Skip to content

decode extended responseName by context class - #605

Merged
cpuschma merged 2 commits into
go-ldap:masterfrom
netliomax25-code:extended-responsename-class
Jul 6, 2026
Merged

decode extended responseName by context class#605
cpuschma merged 2 commits into
go-ldap:masterfrom
netliomax25-code:extended-responsename-class

Conversation

@netliomax25-code

Copy link
Copy Markdown
Contributor
  1. In Conn.Extended the ExtendedResponse children are matched on child.Tag only: tag 10 sets Name and tag 11 sets Value.
  2. The optional responseName is [10] context-class, but the resultCode that always precedes it is a universal ENUMERATED with the same tag number, so the result code matches the name case. When a server omits responseName (the usual case), ExtendedResponse.Name ends up holding the raw result code octet ("\x00" on success) instead of an empty string.
  3. Skip non-context-class children before the tag switch, so only the context-tagged responseName/responseValue are read. This mirrors the class-aware decoding already used for other controls.

Verified with a regression test that drives Extended over the in-package fake connection with a success response that carries a responseValue but no responseName; it asserts Name is empty and fails on the current code (Name == "\x00").

@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 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@netliomax25-code Thank you for yor PRs. LGTM, but please take a look at the linting errors. Thank you.

@netliomax25-code

Copy link
Copy Markdown
Contributor Author

Fixed. The two errcheck hits were the unchecked Close() returns in the new test's defers; wrapped both to discard the error explicitly. Lint and the Go 1.25/1.26 validation jobs are green now, and the regression test still passes with -race.

@cpuschma
cpuschma merged commit c90b197 into go-ldap:master Jul 6, 2026
4 checks passed
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