Bug fix: case-insensitive value match (except for passwords)

This commit is contained in:
Alex 2020-02-02 13:32:12 +01:00
parent e9e7a4cb4b
commit 4c037dcb94
3 changed files with 10 additions and 2 deletions

View file

@ -12,7 +12,7 @@ job "directory" {
task "server" { task "server" {
driver = "docker" driver = "docker"
config { config {
image = "lxpz/bottin_amd64:4" image = "lxpz/bottin_amd64:5"
readonly_rootfs = true readonly_rootfs = true
port_map { port_map {
ldap_port = 389 ldap_port = 389

View file

@ -205,7 +205,7 @@ func applyFilter(entry Entry, filter message.Filter) (bool, error) {
for entry_desc, value := range entry { for entry_desc, value := range entry {
if strings.EqualFold(entry_desc, desc) { if strings.EqualFold(entry_desc, desc) {
for _, val := range value { for _, val := range value {
if val == target { if valueMatch(entry_desc, val, target) {
return true, nil return true, nil
} }
} }

View file

@ -138,3 +138,11 @@ func genUuid() string {
} }
return uuid.String() return uuid.String()
} }
func valueMatch(attr, val1, val2 string) bool {
if strings.EqualFold(attr, ATTR_USERPASSWORD) {
return val1 == val2
} else {
return strings.EqualFold(val1, val2)
}
}