mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 15:07:51 +01:00
LDAP: Make a bit more detailed log traces
This is useful especially to check whether we fetch right attributes, using right LDAP search base and in right order.
This commit is contained in:
parent
834d92a47b
commit
5649556a33
@ -78,7 +78,7 @@ func (ls *Source) findUserDN(l *ldap.Conn, name string) (string, bool) {
|
|||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("Searching using filter %s", userFilter)
|
log.Trace("Searching for DN using filter %s and base %s", userFilter, ls.UserBase)
|
||||||
search := ldap.NewSearchRequest(
|
search := ldap.NewSearchRequest(
|
||||||
ls.UserBase, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0,
|
ls.UserBase, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0,
|
||||||
false, userFilter, []string{}, nil)
|
false, userFilter, []string{}, nil)
|
||||||
@ -144,6 +144,7 @@ func (ls *Source) SearchEntry(name, passwd string, directBind bool) (string, str
|
|||||||
return "", "", "", "", false, false
|
return "", "", "", "", false, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Trace("Fetching attributes '%v', '%v', '%v', '%v' with filter %s and base %s", ls.AttributeUsername, ls.AttributeName, ls.AttributeSurname, ls.AttributeMail, userFilter, userDN)
|
||||||
search := ldap.NewSearchRequest(
|
search := ldap.NewSearchRequest(
|
||||||
userDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, userFilter,
|
userDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, userFilter,
|
||||||
[]string{ls.AttributeUsername, ls.AttributeName, ls.AttributeSurname, ls.AttributeMail},
|
[]string{ls.AttributeUsername, ls.AttributeName, ls.AttributeSurname, ls.AttributeMail},
|
||||||
@ -170,6 +171,7 @@ func (ls *Source) SearchEntry(name, passwd string, directBind bool) (string, str
|
|||||||
|
|
||||||
admin_attr := false
|
admin_attr := false
|
||||||
if len(ls.AdminFilter) > 0 {
|
if len(ls.AdminFilter) > 0 {
|
||||||
|
log.Trace("Checking admin with filter %s and base %s", ls.AdminFilter, userDN)
|
||||||
search = ldap.NewSearchRequest(
|
search = ldap.NewSearchRequest(
|
||||||
userDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, ls.AdminFilter,
|
userDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, ls.AdminFilter,
|
||||||
[]string{ls.AttributeName},
|
[]string{ls.AttributeName},
|
||||||
|
Loading…
Reference in New Issue
Block a user