Compare LDAP password with php crypt password
I want to authenticate users on my LDAP server through a PHP script. To start with, I am just trying to match the passwords of LDAP with PHP. But when I try to bind to the ldap server with the dn uid=$user,ou=Users,dc=mydomain,dc=com - authentication fails because the crypt password generated in LDAP dosent match the password generated by the crypt () function in PHP.
I have searched a bit on crypt() function usage in php and tried few algorithms on the plain-text password, but none of the generated password hash matches the password stored in my LDAP database. I am using smbldap-tools in my implementation of LDAP, SAMBA PDC.
The password in LDAP database is 13 characters while php generates a 34 character crypted password string. I am confused on how to match the stored LDAP password with the php password.
Any help here will be appreciated..