From 3808638df10af1b306c98c92986543d57233d0b8 Mon Sep 17 00:00:00 2001
From: Adam Strzelecki <ono@java.pl>
Date: Sun, 7 Feb 2016 18:18:29 +0100
Subject: [PATCH] Fix #2221 LDAP username attribute must be fetched

This is fix-up for 573305f. Forgot to fetch AttributeUsername value from the
LDAP server, so the setting was effectively not working as intended.
---
 modules/auth/ldap/ldap.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/auth/ldap/ldap.go b/modules/auth/ldap/ldap.go
index 313c23550..7f36c8bd5 100644
--- a/modules/auth/ldap/ldap.go
+++ b/modules/auth/ldap/ldap.go
@@ -153,7 +153,7 @@ func (ls *Source) SearchEntry(name, passwd string, directBind bool) (string, str
 
 	search := ldap.NewSearchRequest(
 		userDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, userFilter,
-		[]string{ls.AttributeName, ls.AttributeSurname, ls.AttributeMail},
+		[]string{ls.AttributeUsername, ls.AttributeName, ls.AttributeSurname, ls.AttributeMail},
 		nil)
 
 	sr, err := l.Search(search)