feat: [OCISDEV-1031] implement PasswordModify and ModifyWithResult on LDAP clients - #665
Conversation
… LDAP clients ConnWithReconnect and ConnPool (pkg/utils/ldap) stubbed out PasswordModify and ModifyWithResult with a "not implemented" error, copied over from the existing set of unimplemented ldap.Client methods. Implement both on each client via their existing retry helpers (retry on ConnWithReconnect, do on ConnPool), mirroring the retry-on-network-error behaviour already used by Search/Add/Modify/etc., so callers relying on the LDAP Password Modify Extended Operation or on ModifyWithResult work with either client. Signed-off-by: Lukas Hirt <info@hirt.cz>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
Implements PasswordModify and ModifyWithResult for the two LDAP client implementations in pkg/utils/ldap (ConnWithReconnect and ConnPool) by wiring them through the existing retry helpers, preventing callers (e.g., graph service) from hitting the previous “not implemented” behavior.
Changes:
- Add retry-enabled implementations of
ModifyWithResultandPasswordModifytoConnWithReconnect. - Add pooled implementations of
ModifyWithResultandPasswordModifytoConnPoolviado. - Extend
ConnPooltests to cover both methods and add an unreleased changelog entry.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/utils/ldap/reconnect.go | Implements ModifyWithResult/PasswordModify using the existing reconnect retry helper. |
| pkg/utils/ldap/pool.go | Implements ModifyWithResult/PasswordModify using the existing pool do (checkout + retry-on-network-error). |
| pkg/utils/ldap/pool_test.go | Adds forwarding tests for both methods via fakeConn overrides. |
| changelog/unreleased/enhancement-ldap-pool-password-modify.md | Documents the enhancement and links the PR. |
Comments suppressed due to low confidence (1)
pkg/utils/ldap/pool_test.go:54
- fakeConn.ModifyWithResult unconditionally calls modifyWithResultFunc; if fakeConn is created without that override, calling ModifyWithResult will panic. Return a descriptive error when the override is unset to prevent nil-function panics and make test failures clearer.
func (f *fakeConn) ModifyWithResult(req *ldap.ModifyRequest) (*ldap.ModifyResult, error) {
return f.modifyWithResultFunc(req)
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Points worth noting (non-blocking)
|
…dify/ModifyWithResult Addresses review feedback on #665: fakeConn.PasswordModify/ModifyWithResult now return an error instead of panicking when their func overrides aren't set, and the pool's network-error retry path is now exercised for both new methods (previously only the happy path was tested). Signed-off-by: Lukas Hirt <info@hirt.cz>
|
Thanks for the review, replying to each point:
|
|
@2403905 could you please take one more look. THX |
ConnWithReconnectandConnPool(pkg/utils/ldap) stubbed outPasswordModifyandModifyWithResultwith a "not implemented" error, copied over from the existing set of unimplementedldap.Clientmethods. This implements both on each client via their existing retry helpers (retryonConnWithReconnect,doonConnPool), mirroring the retry-on-network-error behaviour already used bySearch/Add/Modify/etc.This is a prerequisite for unifying oCIS's graph service onto this package's LDAP client: graph's own hand-rolled reconnect implementation fully implements both methods (and actually calls
PasswordModifybehindGRAPH_LDAP_SERVER_USE_PASSWORD_MODIFY_EXOP), so swapping it ontoConnWithReconnect/ConnPoolas-is would silently break that path.Follow-up to #658 (OCISDEV-1031).