Converts group and subgroup to lowercase for comparison.

Fixes #679
This commit is contained in:
Fearghal O Floinn 2021-09-08 12:24:49 +01:00
parent efac0926df
commit 7a94b0c157

View file

@ -5,6 +5,7 @@ import (
"encoding/binary"
"encoding/json"
"math/big"
"strings"
"time"
"github.com/pkg/errors"
@ -453,12 +454,20 @@ func containsAllMembers(group, subgroup []string) bool {
if lsg > lg || (lg > 0 && lsg == 0) {
return false
}
groupLower := []string{}
subgroupLower := []string{}
for _, s := range group {
groupLower = append(groupLower, strings.ToLower(s))
}
for _, s := range subgroup {
subgroupLower = append(subgroupLower, strings.ToLower(s))
}
visit := make(map[string]struct{}, lg)
for i := 0; i < lg; i++ {
visit[group[i]] = struct{}{}
visit[groupLower[i]] = struct{}{}
}
for i := 0; i < lsg; i++ {
if _, ok := visit[subgroup[i]]; !ok {
if _, ok := visit[subgroupLower[i]]; !ok {
return false
}
}