LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 01-29-2006, 11:45 AM   #1
coolamit78
Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: RHEL AS 3/4, Windows XP
Posts: 546

Rep: Reputation: 31
Compare LDAP password with php crypt password


Hi..

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..

Thanks,

Amit
 
Old 01-30-2006, 06:35 AM   #2
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 48
to verify a password, you do something like
Code:
if (crypt($user_input, $password_hash) == $password_hash) {
   echo "Password verified!";
}
because hashes are salted, so you need to give the salt in the original hash to generate the same hash; also, crypt() in PHP supports different algorithms (the 34 character one was probably MD5) and giving it the original hash will tell it to use the proper algorithm to use (the 13 character one is probably traditional DES)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sync ldap and samba password with ldappasswd paul_mat Linux - Networking 2 11-21-2005 11:55 PM
deleting LDAP user...password? blink_00 Suse/Novell 3 02-21-2005 12:24 PM
using a random file as password to dm-crypt qwijibow Linux - Security 6 11-08-2004 12:57 PM
How can I change e-mail password(or linux account password) with php in website?? yusuf Programming 1 05-28-2004 10:39 AM
change password at slave ldap u4113072 Linux - Software 0 11-12-2002 03:50 AM


All times are GMT -5. The time now is 05:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration