aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-11 23:20:33 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-11 23:20:33 +0100
commite52a1f74a38cad3df083885aa8860a870a131cdb (patch)
tree7d8c3c52a71d12472a1684814ede04ea86681455
parent9e365d4b538da5f206b5f564f1912c1de26adf10 (diff)
downloadbottin-e52a1f74a38cad3df083885aa8860a870a131cdb.tar.gz
bottin-e52a1f74a38cad3df083885aa8860a870a131cdb.zip
Handle search attribute *
-rw-r--r--bottin.hcl.example2
-rw-r--r--main.go1
-rw-r--r--read.go7
3 files changed, 6 insertions, 4 deletions
diff --git a/bottin.hcl.example b/bottin.hcl.example
index 3d977d4..8a3ad36 100644
--- a/bottin.hcl.example
+++ b/bottin.hcl.example
@@ -12,7 +12,7 @@ job "directory" {
task "server" {
driver = "docker"
config {
- image = "lxpz/bottin_amd64:8"
+ image = "lxpz/bottin_amd64:10"
readonly_rootfs = true
port_map {
ldap_port = 389
diff --git a/main.go b/main.go
index 975311d..9267175 100644
--- a/main.go
+++ b/main.go
@@ -1,6 +1,5 @@
package main
-
import (
"crypto/rand"
"crypto/tls"
diff --git a/read.go b/read.go
index ab80d1c..43833e8 100644
--- a/read.go
+++ b/read.go
@@ -124,7 +124,7 @@ func (server *Server) handleSearchInternal(state *State, w ldap.ResponseWriter,
}
} else if r.Scope() == message.SearchRequestSingleLevel {
objectLevel := len(strings.Split(dn, ","))
- if objectLevel != baseObjectLevel + 1 {
+ if objectLevel != baseObjectLevel+1 {
continue
}
}
@@ -148,7 +148,10 @@ func (server *Server) handleSearchInternal(state *State, w ldap.ResponseWriter,
if len(r.Attributes()) > 0 {
found := false
for _, requested := range r.Attributes() {
- if strings.EqualFold(string(requested), attr) {
+ if string(requested) == "1.1" && len(r.Attributes()) == 1 {
+ break
+ }
+ if string(requested) == "*" || strings.EqualFold(string(requested), attr) {
found = true
break
}