Update wrapper and mocks for go-ldap 3.4.6

This commit is contained in:
Ralf Haferkamp
2023-11-22 15:12:39 +01:00
committed by Ralf Haferkamp
parent 49db85d820
commit 6ac5ac534d
2 changed files with 69 additions and 0 deletions
+50
View File
@@ -3,6 +3,8 @@
package mocks
import (
context "context"
ldap "github.com/go-ldap/ldap/v3"
mock "github.com/stretchr/testify/mock"
@@ -122,6 +124,22 @@ func (_m *Client) DirSync(searchRequest *ldap.SearchRequest, flags int64, maxAtt
return r0, r1
}
// DirSyncAsync provides a mock function with given fields: ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie
func (_m *Client) DirSyncAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, flags int64, maxAttrCount int64, cookie []byte) ldap.Response {
ret := _m.Called(ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie)
var r0 ldap.Response
if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int, int64, int64, []byte) ldap.Response); ok {
r0 = rf(ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(ldap.Response)
}
}
return r0
}
// ExternalBind provides a mock function with given fields:
func (_m *Client) ExternalBind() error {
ret := _m.Called()
@@ -284,6 +302,22 @@ func (_m *Client) Search(_a0 *ldap.SearchRequest) (*ldap.SearchResult, error) {
return r0, r1
}
// SearchAsync provides a mock function with given fields: ctx, searchRequest, bufferSize
func (_m *Client) SearchAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int) ldap.Response {
ret := _m.Called(ctx, searchRequest, bufferSize)
var r0 ldap.Response
if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int) ldap.Response); ok {
r0 = rf(ctx, searchRequest, bufferSize)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(ldap.Response)
}
}
return r0
}
// SearchWithPaging provides a mock function with given fields: searchRequest, pagingSize
func (_m *Client) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error) {
ret := _m.Called(searchRequest, pagingSize)
@@ -360,6 +394,22 @@ func (_m *Client) StartTLS(_a0 *tls.Config) error {
return r0
}
// Syncrepl provides a mock function with given fields: ctx, searchRequest, bufferSize, mode, cookie, reloadHint
func (_m *Client) Syncrepl(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, mode ldap.ControlSyncRequestMode, cookie []byte, reloadHint bool) ldap.Response {
ret := _m.Called(ctx, searchRequest, bufferSize, mode, cookie, reloadHint)
var r0 ldap.Response
if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int, ldap.ControlSyncRequestMode, []byte, bool) ldap.Response); ok {
r0 = rf(ctx, searchRequest, bufferSize, mode, cookie, reloadHint)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(ldap.Response)
}
}
return r0
}
// TLSConnectionState provides a mock function with given fields:
func (_m *Client) TLSConnectionState() (tls.ConnectionState, bool) {
ret := _m.Called()
@@ -4,6 +4,7 @@ package ldap
// https://gist.github.com/emsearcy/cba3295d1a06d4c432ab4f6173b65e4f#file-ldap_snippet-go
import (
"context"
"crypto/tls"
"errors"
"fmt"
@@ -336,6 +337,12 @@ func (c ConnWithReconnect) SearchWithPaging(searchRequest *ldap.SearchRequest, p
return nil, ldap.NewError(ldap.LDAPResultNotSupported, fmt.Errorf("not implemented"))
}
// SearchAsync implements the ldap.Client interface
func (c ConnWithReconnect) SearchAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int) ldap.Response {
// unimplemented
return nil
}
// NTLMUnauthenticatedBind implements the ldap.Client interface
func (c ConnWithReconnect) NTLMUnauthenticatedBind(domain, username string) error {
return ldap.NewError(ldap.LDAPResultNotSupported, fmt.Errorf("not implemented"))
@@ -355,3 +362,15 @@ func (c ConnWithReconnect) Unbind() error {
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"))
}
// DirSyncAsync implements the ldap.Client interface
func (c ConnWithReconnect) DirSyncAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, flags, maxAttrCount int64, cookie []byte) ldap.Response {
// unimplemented
return nil
}
// Syncrepl implements the ldap.Client interface
func (c ConnWithReconnect) Syncrepl(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, mode ldap.ControlSyncRequestMode, cookie []byte, reloadHint bool) ldap.Response {
// unimplemented
return nil
}