@@ -26,7 +26,7 @@ type LdapConfig struct {
2626 UserBind string `json:"user-bind"`
2727 UserFilter string `json:"user-filter"`
2828 UserAttr string `json:"username-attr"`
29- UidAttr string `json:"uid-attr"`
29+ UIDAttr string `json:"uid-attr"`
3030 SyncInterval string `json:"sync-interval"` // Parsed using time.ParseDuration.
3131 SyncDelOldUsers bool `json:"sync-del-old-users"`
3232
@@ -38,7 +38,7 @@ type LdapConfig struct {
3838type LdapAuthenticator struct {
3939 syncPassword string
4040 UserAttr string
41- UidAttr string
41+ UIDAttr string
4242}
4343
4444var _ Authenticator = (* LdapAuthenticator )(nil )
@@ -55,10 +55,10 @@ func (la *LdapAuthenticator) Init() error {
5555 la .UserAttr = "gecos"
5656 }
5757
58- if Keys .LdapConfig .UidAttr != "" {
59- la .UidAttr = Keys .LdapConfig .UidAttr
58+ if Keys .LdapConfig .UIDAttr != "" {
59+ la .UIDAttr = Keys .LdapConfig .UIDAttr
6060 } else {
61- la .UidAttr = "uid"
61+ la .UIDAttr = "uid"
6262 }
6363
6464 return nil
@@ -88,8 +88,8 @@ func (la *LdapAuthenticator) CanLogin(
8888 searchRequest := ldap .NewSearchRequest (
8989 lc .UserBase ,
9090 ldap .ScopeWholeSubtree , ldap .NeverDerefAliases , 0 , 0 , false ,
91- fmt .Sprintf ("(&%s(%s=%s))" , lc .UserFilter , la .UidAttr , ldap .EscapeFilter (username )),
92- []string {"dn" , la .UidAttr , la .UserAttr }, nil )
91+ fmt .Sprintf ("(&%s(%s=%s))" , lc .UserFilter , la .UIDAttr , ldap .EscapeFilter (username )),
92+ []string {"dn" , la .UIDAttr , la .UserAttr }, nil )
9393
9494 sr , err := l .Search (searchRequest )
9595 if err != nil {
@@ -169,17 +169,17 @@ func (la *LdapAuthenticator) Sync() error {
169169 lc .UserBase ,
170170 ldap .ScopeWholeSubtree , ldap .NeverDerefAliases , 0 , 0 , false ,
171171 lc .UserFilter ,
172- []string {"dn" , la .UidAttr , la .UserAttr }, nil ))
172+ []string {"dn" , la .UIDAttr , la .UserAttr }, nil ))
173173 if err != nil {
174174 cclog .Warn ("LDAP search error" )
175175 return err
176176 }
177177
178178 newnames := map [string ]string {}
179179 for _ , entry := range ldapResults .Entries {
180- username := entry .GetAttributeValue (la .UidAttr )
180+ username := entry .GetAttributeValue (la .UIDAttr )
181181 if username == "" {
182- return fmt .Errorf ("no attribute '%s'" , la .UidAttr )
182+ return fmt .Errorf ("no attribute '%s'" , la .UIDAttr )
183183 }
184184
185185 _ , ok := users [username ]
0 commit comments