diff options
author | David Svantesson <davidsvantesson@gmail.com> | 2019-08-24 20:53:37 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-08-24 21:53:37 +0300 |
commit | 8c24bb9e4344791ca2e8c66efcf3d45881365a5d (patch) | |
tree | 817a0a090a96cf9db8eebdf5928442a9f3ed01d6 /modules/auth | |
parent | e3115cc019211fa2549f6943d379bf58fe7b7d7d (diff) | |
download | gitea-8c24bb9e4344791ca2e8c66efcf3d45881365a5d.tar.gz gitea-8c24bb9e4344791ca2e8c66efcf3d45881365a5d.zip |
Abort syncrhonization from LDAP source if there is some error. (#7960)
Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
Diffstat (limited to 'modules/auth')
-rw-r--r-- | modules/auth/ldap/ldap.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/auth/ldap/ldap.go b/modules/auth/ldap/ldap.go index ddeaf12430..ed83a77e12 100644 --- a/modules/auth/ldap/ldap.go +++ b/modules/auth/ldap/ldap.go @@ -308,12 +308,12 @@ func (ls *Source) UsePagedSearch() bool { } // SearchEntries : search an LDAP source for all users matching userFilter -func (ls *Source) SearchEntries() []*SearchResult { +func (ls *Source) SearchEntries() ([]*SearchResult, error) { l, err := dial(ls) if err != nil { log.Error("LDAP Connect error, %s:%v", ls.Host, err) ls.Enabled = false - return nil + return nil, err } defer l.Close() @@ -321,7 +321,7 @@ func (ls *Source) SearchEntries() []*SearchResult { err := l.Bind(ls.BindDN, ls.BindPassword) if err != nil { log.Debug("Failed to bind as BindDN[%s]: %v", ls.BindDN, err) - return nil + return nil, err } log.Trace("Bound as BindDN %s", ls.BindDN) } else { @@ -350,7 +350,7 @@ func (ls *Source) SearchEntries() []*SearchResult { } if err != nil { log.Error("LDAP Search failed unexpectedly! (%v)", err) - return nil + return nil, err } result := make([]*SearchResult, len(sr.Entries)) @@ -368,5 +368,5 @@ func (ls *Source) SearchEntries() []*SearchResult { } } - return result + return result, nil } |