From b74eeed359c7a598e58d558d2c5e84106ee63dfd Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Mon, 10 Jul 2023 12:09:50 +0200 Subject: [PATCH] ldap: Implement missing methods for 3.4.5 go-ldap in ldap reconnect wrapper --- services/graph/pkg/identity/ldap/reconnect.go | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/services/graph/pkg/identity/ldap/reconnect.go b/services/graph/pkg/identity/ldap/reconnect.go index 31525eea1e..3d4d23ebbd 100644 --- a/services/graph/pkg/identity/ldap/reconnect.go +++ b/services/graph/pkg/identity/ldap/reconnect.go @@ -277,7 +277,25 @@ func (c ConnWithReconnect) StartTLS(*tls.Config) error { return ldap.NewError(ldap.LDAPResultNotSupported, fmt.Errorf("not implemented")) } -func (c ConnWithReconnect) Close() {} +// Close implements the ldap.Client interface +func (c ConnWithReconnect) Close() (err error) { + conn, err := c.GetConnection() + + if err != nil { + return err + } + return conn.Close() +} + +// GetLastError implements the ldap.Client interface +func (c ConnWithReconnect) GetLastError() error { + conn, err := c.GetConnection() + + if err != nil { + return err + } + return conn.GetLastError() +} func (c ConnWithReconnect) IsClosing() bool { return false @@ -332,3 +350,8 @@ func (c ConnWithReconnect) TLSConnectionState() (tls.ConnectionState, bool) { func (c ConnWithReconnect) Unbind() error { return ldap.NewError(ldap.LDAPResultNotSupported, fmt.Errorf("not implemented")) } + +// DirSync implements the ldap.Client interface +func (c ConnWithReconnect) DirSync(searchRequest *ldap.SearchRequest, flags, maxAttrCount int64, cookie []byte) (*ldap.SearchResult, error) { + return nil, ldap.NewError(ldap.LDAPResultNotSupported, fmt.Errorf("not implemented")) +}