title: How to bind (authenticate) a user with ldap3 in python3
body: <p>I'm trying to update some code to python3, using <a href="http://ldap3.readthedocs.org/en/latest/quicktour.html" rel="noreferrer">ldap3</a> version '0.9.7.4'.
  (<a href="https://pypi.python.org/pypi/ldap3" rel="noreferrer">https://pypi.python.org/pypi/ldap3</a>)</p>
  
  <p>Previously, I used python-ldap with python2 to authenticate a user like this:</p>
  
  <pre><code>import ldap
  address = "ldap://HOST:389"
  con = ldap.initialize(address)
  base_dn = "ourDN=jjj"
  con.protocol_version = ldap.VERSION3
  search_filter = "(uid=USERNAME)"
  result = con.search_s(base_dn, ldap.SCOPE_SUBTREE, search_filter, None)  
  user_dn = result[0][0]  # get the user DN
  con.simple_bind_s(user_dn, "PASSWORD")
  </code></pre>
  
  <p>This properly returns <code>(97, [], 2, [])</code> on correct password, and raises <code>ldap.INVALID_CREDENTIALS</code> on a bind attempt using an incorrect password.</p>
  
  <p>Using <code>ldap3</code> in python3 I'm doing the following:</p>
  
  <pre><code>from ldap3 import Server, Connection, AUTH_SIMPLE, STRATEGY_SYNC, ALL
  s = Server(HOST, port=389, get_info=ALL)
  c = Connection(s, authentication=AUTH_SIMPLE, user=user_dn, password=PASSWORD, check_names=True, lazy=False, client_strategy=STRATEGY_SYNC, raise_exceptions=True)
  c.open()
  c.bind()
  </code></pre>
  
  <p>It's raising the following exception:</p>
  
  <pre><code>ldap3.core.exceptions.LDAPInvalidCredentialsResult: LDAPInvalidCredentialsResult - 49 - invalidCredentials - [{'dn': '', 'message': '', 'type': 'bindResponse', 'result': 0, 'saslCreds': 'None', 'description': 'success', 'referrals': None}]
  </code></pre>
  
  <p>I'm using the <code>user_dn</code> value returned by python2's ldap search, since this appears to be working in python2.</p>
  
  <p>How can I get this to bind properly using ldap3 in python3?</p>
  
  <p>(<em>One thing strange, I noticed, is that the ldap3's LDAPInvalidCredentialsResult includes <code>'description': 'success'</code>.  I'm guessing this just means response successfully recieved...</em>)</p>