Improve and cleanup

I had to use LDAP for a website I've made but there was several things that wasn't working due to some hardcoded behavior. By the way I have added some more options and enhancements:
 * Switch to ldapInitialize. This is more flexible, I wasn't able to connect because my server runs only with LDAPS. ldapInitialize fixes the problem because it allows to pass a LDAP URI which specify more precisely what we want (ldap:// or ldaps:// or ldapi://).
 * We should use the DN returned by the matching entry instead of asking it from the library user.
 * We only need to return a single result because we bind only one entry anyway.
 * We shouldn't hardcode the attribute that is used for the query (here sAMAccountName).

The function and data signatures have changed, this will break user code but: the change are trivial (I can document them if necessary) and the changes have many benefits (flexibility, easier to use, etc).

Please review and feel free to comment my patches. It is tested and used in (my) production.