diff options
| author | Marin Ivanov <[email protected]> | 2019-02-13 07:20:14 +0200 |
|---|---|---|
| committer | Marin Ivanov <[email protected]> | 2019-02-13 07:26:13 +0200 |
| commit | a1a0a3aae7ef762250b9295985be1eee41d7a49e (patch) | |
| tree | 39accaebbd5c1fad072fc7ecb2360c0db6b21bef /server_modify_test.go | |
| parent | cb4f041b8be79b49eb046466ceb1bea9cfcaeb87 (diff) | |
Revert the simplification of Searcher and Binder interfaces
* Revert "Simplify sever search functions" commit 9402a7d580c2dd929c68cf8b3038a1e6496f607f.
* Revert "Simplify server bind functions" commit 82a8f44a2f4cf0686635d2a23ebb41a8f445194e.
* Fix tests
Diffstat (limited to 'server_modify_test.go')
| -rw-r--r-- | server_modify_test.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server_modify_test.go b/server_modify_test.go index f6f54cc..b13a98f 100644 --- a/server_modify_test.go +++ b/server_modify_test.go @@ -15,7 +15,7 @@ func TestAdd(t *testing.T) { defer s.Close() ln, addr := mustListen() go func() { - s.Bind = BindAnonOK + s.BindFunc("", modifyTestHandler{}) s.AddFunc("", modifyTestHandler{}) if err := s.Serve(ln); err != nil { t.Errorf("s.Serve failed: %s", err.Error()) @@ -51,7 +51,7 @@ func TestDelete(t *testing.T) { defer s.Close() ln, addr := mustListen() go func() { - s.Bind = BindAnonOK + s.BindFunc("", modifyTestHandler{}) s.DeleteFunc("", modifyTestHandler{}) if err := s.Serve(ln); err != nil { t.Errorf("s.Serve failed: %s", err.Error()) @@ -83,7 +83,7 @@ func TestModify(t *testing.T) { defer s.Close() ln, addr := mustListen() go func() { - s.Bind = BindAnonOK + s.BindFunc("", modifyTestHandler{}) s.ModifyFunc("", modifyTestHandler{}) if err := s.Serve(ln); err != nil { t.Errorf("s.Serve failed: %s", err.Error()) @@ -152,6 +152,12 @@ func TestModifyDN(t *testing.T) { type modifyTestHandler struct { } +func (h modifyTestHandler) Bind(bindDN, bindSimplePw string, conn net.Conn) (LDAPResultCode, error) { + if bindDN == "" && bindSimplePw == "" { + return LDAPResultSuccess, nil + } + return LDAPResultInvalidCredentials, nil +} func (h modifyTestHandler) Add(boundDN string, req AddRequest, conn net.Conn) (LDAPResultCode, error) { // only succeed on expected contents of add.ldif: if len(req.attributes) == 5 && req.dn == "cn=Barbara Jensen,dc=example,dc=com" && |
