File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -165,11 +165,8 @@ func (c Config) checkConfig() {
165165 } else {
166166 log .Printf ("DialTLS:=%v:%d" , c .LdapURL , c .LdapPort )
167167 }
168- if len (c .LdapBindDN ) == 0 {
169- log .Println ("BIND_DN is empty" )
170- }
171- if len (c .LdapBindPassword ) == 0 {
172- log .Println ("BIND_PASSWORD is empty" )
168+ if (len (c .LdapBindDN ) > 0 && len (c .LdapBindPassword ) == 0 ) {
169+ log .Println ("BIND_DN supplied, but BIND_PASSWORD is empty" )
173170 }
174171 if len (c .LdapFilter ) == 0 {
175172 log .Println ("LDAP_FILTER is empty" )
@@ -222,10 +219,16 @@ func mainJob() {
222219 }
223220 defer l .Close ()
224221
225- err = l .Bind (cfg .LdapBindDN , cfg .LdapBindPassword )
222+ if len (cfg .LdapBindDN ) == 0 {
223+ err = l .UnauthenticatedBind ("" )
224+ } else {
225+ err = l .Bind (cfg .LdapBindDN , cfg .LdapBindPassword )
226+ }
227+
226228 if err != nil {
227229 log .Fatal (err )
228230 }
231+
229232 page := 1
230233 cfg .ApiKeys .BruteforceTokenKey = 0
231234 cfg .ApiKeys .Command = "/api/v1/admin/orgs?page=" + fmt .Sprintf ("%d" , page ) + "&limit=20&access_token=" // List all organizations
You can’t perform that action at this time.
0 commit comments