LDAP authentication issue in python using ldap library
<p>I am trying to connect to LDAP server for authentication. Our LDAP server use SSL but we don't use any SSL certificate.</p>

<p>Following is my code:</p>

<p>I have two url provided by system admin. There are as follows:</p>

<pre><code>url1 = "ldap://100.x.x.x:389"
url2 = "ldaps://10.x.x.x:636"
</code></pre>

<p>My first questionis which url I should use ? what is difference between ldap:// and ldaps://</p>

<p>LDAP authentication code is as follows, I have tried to use both(url1 and url2):</p>

<pre><code>conn = ldap.initialize(url)

ldap.TLS_AVAIL
1

conn.simple_bind_s(
        'CN={0},ou=users,DC=compnay,DC=com'.format(myemail),
        mypassword
    )

conn.simple_bind(
        'CN={0},ou=users,DC=compnay,DC=com'.format(myemail),
        mypassword
    )
</code></pre>

<p>if i used first url (url1) with simple_bind_s, then following is error:</p>

<blockquote>
  <p>INVALID_CREDENTIALS: {'info': u'80090308: LdapErr: DSID-0C0903D9, comment: AcceptSecurityContext error, data 52e, v2580', 'desc': u'Invalid credentials'}</p>
</blockquote>

<p>but when I use with simple_bind, it gives me int even though password or username is wrong.</p>

<p>What is difference between  simple_bind_s and simple_bind. How can I use simple_bind for authentication?</p>