return
}
- sr := s.LDAP().SearchEntries()
+ sr, err := s.LDAP().SearchEntries()
+ if err != nil {
+ log.Error("SyncExternalUsers LDAP source failure [%s], skipped", s.Name)
+ continue
+ }
+
for _, su := range sr {
if len(su.Username) == 0 {
continue
}
// 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()
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 {
}
if err != nil {
log.Error("LDAP Search failed unexpectedly! (%v)", err)
- return nil
+ return nil, err
}
result := make([]*SearchResult, len(sr.Entries))
}
}
- return result
+ return result, nil
}