title: Whats is the LDAP Authentication best practice?
body: <p>I want to know the best practice for authenticating users using <code>OpenLDAP</code>. I could perform a search using the <code>cn</code>. </p>
  
  <p>But then what if I got multiple hits with similar <code>cn</code> (under different ancestors of course) and they all use the same password?</p>
  
  <p>I tried to use <code>uids</code> but then I got some types of accounts that do not use uids (like mail accounts and the admin <code>cn</code>). Also, when I added some users under the admin <code>cn</code> (which has no <code>uid</code>) I could not login with the admin <code>cn</code>.</p>
  
  <p>What is the unique key that identifies a user?</p>
  
  <p><strong>Note</strong>: I am using <code>phpldapadmin</code> to manage the active directory, and <code>openldap</code> for the c++ code.</p>