summaryrefslogtreecommitdiffstats
path: root/server_search_test.go
diff options
context:
space:
mode:
authorViktor Kojouharov <vkojouharov@gmail.com>2019-07-03 20:24:33 +0200
committerNed McClain <nedmcclain@gmail.com>2019-07-03 20:24:33 +0200
commit09931d85c0ffc965b063db4b63071e121106dfaf (patch)
treed83bf549a182fe09fc6338e06de3d6bf40fd90b5 /server_search_test.go
parentmake serve function public (#4) (diff)
downloadldap-09931d85c0ffc965b063db4b63071e121106dfaf.tar
ldap-09931d85c0ffc965b063db4b63071e121106dfaf.tar.gz
ldap-09931d85c0ffc965b063db4b63071e121106dfaf.tar.bz2
ldap-09931d85c0ffc965b063db4b63071e121106dfaf.tar.lz
ldap-09931d85c0ffc965b063db4b63071e121106dfaf.tar.xz
ldap-09931d85c0ffc965b063db4b63071e121106dfaf.tar.zst
ldap-09931d85c0ffc965b063db4b63071e121106dfaf.zip
Diffstat (limited to 'server_search_test.go')
-rw-r--r--server_search_test.go52
1 files changed, 52 insertions, 0 deletions
diff --git a/server_search_test.go b/server_search_test.go
index ed6b6d6..5a083b0 100644
--- a/server_search_test.go
+++ b/server_search_test.go
@@ -339,6 +339,58 @@ func TestSearchAttributes(t *testing.T) {
quit <- true
}
+func TestSearchAllUserAttributes(t *testing.T) {
+ quit := make(chan bool)
+ done := make(chan bool)
+ go func() {
+ s := NewServer()
+ s.EnforceLDAP = true
+ s.QuitChannel(quit)
+ s.SearchFunc("", searchSimple{})
+ s.BindFunc("", bindSimple{})
+ if err := s.ListenAndServe(listenString); err != nil {
+ t.Errorf("s.ListenAndServe failed: %s", err.Error())
+ }
+ }()
+
+ go func() {
+ filterString := ""
+ cmd := exec.Command("ldapsearch", "-H", ldapURL, "-x",
+ "-b", serverBaseDN, "-D", "cn=testy,"+serverBaseDN, "-w", "iLike2test", filterString, "*")
+ out, _ := cmd.CombinedOutput()
+
+ if !strings.Contains(string(out), "dn: cn=ned,o=testers,c=test") {
+ t.Errorf("ldapsearch failed - missing requested DN attribute: %v", string(out))
+ }
+ if !strings.Contains(string(out), "cn: ned") {
+ t.Errorf("ldapsearch failed - missing requested CN attribute: %v", string(out))
+ }
+ if !strings.Contains(string(out), "uidNumber") {
+ t.Errorf("ldapsearch failed - missing requested uidNumber attribute: %v", string(out))
+ }
+ if !strings.Contains(string(out), "accountstatus") {
+ t.Errorf("ldapsearch failed - missing requested accountstatus attribute: %v", string(out))
+ }
+ if !strings.Contains(string(out), "o: ate") {
+ t.Errorf("ldapsearch failed - missing requested o attribute: %v", string(out))
+ }
+ if !strings.Contains(string(out), "description") {
+ t.Errorf("ldapsearch failed - missing requested description attribute: %v", string(out))
+ }
+ if !strings.Contains(string(out), "objectclass") {
+ t.Errorf("ldapsearch failed - missing requested objectclass attribute: %v", string(out))
+ }
+ done <- true
+ }()
+
+ select {
+ case <-done:
+ case <-time.After(timeout):
+ t.Errorf("ldapsearch command timed out")
+ }
+ quit <- true
+}
+
/////////////////////////
func TestSearchScope(t *testing.T) {
quit := make(chan bool)