diff options
author | Unknwon <u@gogs.io> | 2016-07-12 07:07:57 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-07-12 07:07:57 +0800 |
commit | a752f0905551a0d8fd6edb893f748cb9490a28dc (patch) | |
tree | 2a29a99725fe1b7ee3471e087e1dd89e1a51b0f6 /modules/auth/ldap | |
parent | 846bf2ca9fcb4cd8cc85cc189e9f153c04080e5d (diff) | |
download | gitea-a752f0905551a0d8fd6edb893f748cb9490a28dc.tar.gz gitea-a752f0905551a0d8fd6edb893f748cb9490a28dc.zip |
#2709 validate username attribute fetched from LDAP
Diffstat (limited to 'modules/auth/ldap')
-rw-r--r-- | modules/auth/ldap/ldap.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/auth/ldap/ldap.go b/modules/auth/ldap/ldap.go index 598929d9e5..55364bfcce 100644 --- a/modules/auth/ldap/ldap.go +++ b/modules/auth/ldap/ldap.go @@ -210,12 +210,12 @@ func (ls *Source) SearchEntry(name, passwd string, directBind bool) (string, str return "", "", "", "", false, false } - username_attr := sr.Entries[0].GetAttributeValue(ls.AttributeUsername) - name_attr := sr.Entries[0].GetAttributeValue(ls.AttributeName) - sn_attr := sr.Entries[0].GetAttributeValue(ls.AttributeSurname) - mail_attr := sr.Entries[0].GetAttributeValue(ls.AttributeMail) + username := sr.Entries[0].GetAttributeValue(ls.AttributeUsername) + firstname := sr.Entries[0].GetAttributeValue(ls.AttributeName) + surname := sr.Entries[0].GetAttributeValue(ls.AttributeSurname) + mail := sr.Entries[0].GetAttributeValue(ls.AttributeMail) - admin_attr := false + isAdmin := false if len(ls.AdminFilter) > 0 { log.Trace("Checking admin with filter %s and base %s", ls.AdminFilter, userDN) search = ldap.NewSearchRequest( @@ -229,7 +229,7 @@ func (ls *Source) SearchEntry(name, passwd string, directBind bool) (string, str } else if len(sr.Entries) < 1 { log.Error(4, "LDAP Admin Search failed") } else { - admin_attr = true + isAdmin = true } } @@ -241,5 +241,5 @@ func (ls *Source) SearchEntry(name, passwd string, directBind bool) (string, str } } - return username_attr, name_attr, sn_attr, mail_attr, admin_attr, true + return username, firstname, surname, mail, isAdmin, true } |