diff options
author | Alex Auvolat <alex@adnab.me> | 2020-11-13 12:55:32 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-11-13 12:55:32 +0100 |
commit | e4b5c67be0594575ef1f2ea729012ea5ad030a6a (patch) | |
tree | e7231e793b052800702efa379d0c30a0ed8f1d95 /memberof.go | |
parent | 4367e4a232938b03fb371ae2ee854458a5802fda (diff) | |
download | bottin-e4b5c67be0594575ef1f2ea729012ea5ad030a6a.tar.gz bottin-e4b5c67be0594575ef1f2ea729012ea5ad030a6a.zip |
Style changes
Diffstat (limited to 'memberof.go')
-rw-r--r-- | memberof.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/memberof.go b/memberof.go index cd0686a..e07ed6c 100644 --- a/memberof.go +++ b/memberof.go @@ -13,8 +13,8 @@ func (server *Server) memberOfAdd(member string, group string) { } // Return early if group is already in memberOf - for _, mb := range memberGroups { - if mb == group { + for _, g := range memberGroups { + if g == group { server.logger.Warnf("Inconsistency detected, %s was memberOf %s at a time when it didn't exist! (not an issue anymore)", member, group) return @@ -23,7 +23,7 @@ func (server *Server) memberOfAdd(member string, group string) { // Add group to memberOf memberGroups = append(memberGroups, group) - err = server.addElements(member, Entry{ + err = server.putAttributes(member, Entry{ ATTR_MEMBEROF: memberGroups, }) if err != nil { @@ -41,9 +41,9 @@ func (server *Server) memberOfRemove(member string, group string) { // Filter out group newMemberOf := []string{} - for _, mb := range memberOf { - if mb != group { - newMemberOf = append(newMemberOf, mb) + for _, g := range memberOf { + if g != group { + newMemberOf = append(newMemberOf, g) } } @@ -55,7 +55,7 @@ func (server *Server) memberOfRemove(member string, group string) { } // Update value of memberOf - err = server.addElements(member, Entry{ + err = server.putAttributes(member, Entry{ ATTR_MEMBEROF: newMemberOf, }) if err != nil { @@ -105,7 +105,7 @@ func (server *Server) memberOfResync() error { } if len(keepMember) != len(member) { server.logger.Warnf("Writing new member list for %s", dn) - err = server.addElements(dn, Entry{ + err = server.putAttributes(dn, Entry{ ATTR_MEMBER: keepMember, }) if err != nil { @@ -134,7 +134,7 @@ func (server *Server) memberOfResync() error { if different { server.logger.Warnf("Fixing memberOf for %s (%d -> %d)", dn, len(prevMemberOf), len(newMemberOfV)) - err = server.addElements(dn, Entry{ + err = server.putAttributes(dn, Entry{ ATTR_MEMBEROF: newMemberOfV, }) if err != nil { |