diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2021-07-20 18:27:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-20 18:27:43 +0200 |
commit | 7f8d1e44eeba4156c0a258b6a1af47cb0a7e2d80 (patch) | |
tree | 16215733e543353c2bd5efd1dcf89c7879e2ad3d /server_search_test.go | |
parent | Fixed handling of UTF8 chars in filter value (#9) (diff) | |
download | ldap-7f8d1e44eeba4156c0a258b6a1af47cb0a7e2d80.tar ldap-7f8d1e44eeba4156c0a258b6a1af47cb0a7e2d80.tar.gz ldap-7f8d1e44eeba4156c0a258b6a1af47cb0a7e2d80.tar.bz2 ldap-7f8d1e44eeba4156c0a258b6a1af47cb0a7e2d80.tar.lz ldap-7f8d1e44eeba4156c0a258b6a1af47cb0a7e2d80.tar.xz ldap-7f8d1e44eeba4156c0a258b6a1af47cb0a7e2d80.tar.zst ldap-7f8d1e44eeba4156c0a258b6a1af47cb0a7e2d80.zip |
Diffstat (limited to 'server_search_test.go')
-rw-r--r-- | server_search_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/server_search_test.go b/server_search_test.go index 5a083b0..09e2b14 100644 --- a/server_search_test.go +++ b/server_search_test.go @@ -451,6 +451,42 @@ func TestSearchScope(t *testing.T) { quit <- true } + +///////////////////////// +func TestSearchScopeCaseInsensitive(t *testing.T) { + quit := make(chan bool) + done := make(chan bool) + go func() { + s := NewServer() + s.EnforceLDAP = true + s.QuitChannel(quit) + s.SearchFunc("", searchCaseInsensitive{}) + s.BindFunc("", bindCaseInsensitive{}) + if err := s.ListenAndServe(listenString); err != nil { + t.Errorf("s.ListenAndServe failed: %s", err.Error()) + } + }() + + go func() { + cmd := exec.Command("ldapsearch", "-H", ldapURL, "-x", + "-b", "cn=Case,o=testers,c=test", "-D", "cn=CAse,o=testers,c=test", "-w", "iLike2test", "-s", "base", "cn=CASe") + out, _ := cmd.CombinedOutput() + if !strings.Contains(string(out), "dn: cn=CASE,o=testers,c=test") { + t.Errorf("ldapsearch 'base' scope failed - didn't find expected DN: %v", string(out)) + } + + done <- true + }() + + select { + case <-done: + case <-time.After(timeout): + t.Errorf("ldapsearch command timed out") + } + quit <- true +} + + func TestSearchControls(t *testing.T) { quit := make(chan bool) done := make(chan bool) |