If an LDAP query doesn't carry any kind of authentication, anonymous binds causes an empty or None-set password to result in a successful authentication.

Use a non-empty password while establishing an LDAP connection.

In the following examples, the code builds a LDAP query whose execution carries no authentication or binds anonymously.

In the third and fourth examples, the authentication is established using a password.

  • SonarSource: RSPEC-4433.
  • Python2: LDAP Documentation.
  • Python3: LDAP Documentation.