diff --git a/.gitignore b/.gitignore index f7a8015..27e7c89 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ log.txt -*.pem \ No newline at end of file +*.pem +authcheck \ No newline at end of file diff --git a/main.go b/main.go index df8b3d4..061f32f 100644 --- a/main.go +++ b/main.go @@ -87,13 +87,16 @@ func GetGroupsOfUser(username string, baseDN string, conn *ldap.Conn) ([]string, if len(sr.Entries) != 1 { return nil, fmt.Errorf("user '%s' does not exist", samAccountName) - } + } else { + //sr.PrettyPrint(2) - sr.PrettyPrint(2) - - for _, entry := range sr.Entries { - //entry.PrettyPrint(2) - fmt.Println(entry.GetAttributeValue("memberOf")) + for _, entry := range sr.Entries { + //entry.PrettyPrint(2) + groups := entry.GetAttributeValues("memberOf") + for _, group := range groups { + fmt.Println(group) + } + } } /*