[PHP] Re: php ldap

2005-08-26 Thread Jeff Loiselle

Santosh Jambhlikar wrote:

Hi ,

I  have a ldap server the user password are stored in that. my php 
ldasearch result says that the result is

ldap user password : {SMD5}eRuT8dttD6M6N6tgMJF33/TNAvc=
i want to compare this password with the user given password in other 
application (obviously php) but when i md5(passwordgiven) then it is 
showing different output.

Any suggestions.


MD5 and SMD5 are not the same type of encryption. md5() will not return 
the correct results.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: php ldap

2005-08-26 Thread Santosh Jambhlikar

then can i output the SMD5 of my password in php.


Jeff Loiselle wrote:


Santosh Jambhlikar wrote:


Hi ,

I  have a ldap server the user password are stored in that. my php 
ldasearch result says that the result is

ldap user password : {SMD5}eRuT8dttD6M6N6tgMJF33/TNAvc=
i want to compare this password with the user given password in other 
application (obviously php) but when i md5(passwordgiven) then it 
is showing different output.

Any suggestions.



MD5 and SMD5 are not the same type of encryption. md5() will not 
return the correct results.




--
Santosh Jambhlikar
Linux Administrator
Cash-Tech Solutions
Pride Parmar Galaxy, Pune
Maharashtra.
Ph.
O.:- 56052000
ext. 2150

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: php ldap

2005-08-26 Thread Mark Rees
Santosh Jambhlikar [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 then can i output the SMD5 of my password in php.


 Jeff Loiselle wrote:

  Santosh Jambhlikar wrote:
 
  Hi ,
 
  I  have a ldap server the user password are stored in that. my php
  ldasearch result says that the result is
  ldap user password : {SMD5}eRuT8dttD6M6N6tgMJF33/TNAvc=
  i want to compare this password with the user given password in other
  application (obviously php) but when i md5(passwordgiven) then it
  is showing different output.
  Any suggestions.

You could try to bind to the server using ldap_bind with the supplied
password. That will check if it is valid or not.

 
 
  MD5 and SMD5 are not the same type of encryption. md5() will not
  return the correct results.
 

 --
 Santosh Jambhlikar
 Linux Administrator
 Cash-Tech Solutions
 Pride Parmar Galaxy, Pune
 Maharashtra.
 Ph.
 O.:- 56052000
 ext. 2150

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: php ldap

2005-08-26 Thread Santosh Jambhlikar

$ldaprdn  = 'user';
$ldappass = 'userpass';

$ldapconn = ldap_connect(ldap.mydomain.com)
  or die(Could not connect to LDAP server.);

if ($ldapconn) {

  $ldapbind = ldap_bind($ldapconn,$ldaprdn, $ldappass);

  if ($ldapbind) {
  echo LDAP bind successful...;
  } else {
  echo LDAP bind failed...;
  }

}

this program is giving me *Invalid DN syntax*  error. what's wrong? cn 
for the the user is user



Mark Rees wrote:


Santosh Jambhlikar [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 


then can i output the SMD5 of my password in php.


Jeff Loiselle wrote:

   


Santosh Jambhlikar wrote:

 


Hi ,

I  have a ldap server the user password are stored in that. my php
ldasearch result says that the result is
ldap user password : {SMD5}eRuT8dttD6M6N6tgMJF33/TNAvc=
i want to compare this password with the user given password in other
application (obviously php) but when i md5(passwordgiven) then it
is showing different output.
Any suggestions.
   



You could try to bind to the server using ldap_bind with the supplied
password. That will check if it is valid or not.

 


MD5 and SMD5 are not the same type of encryption. md5() will not
return the correct results.

 

   



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Fwd: Re: [PHP] Re: php ldap]

2005-08-26 Thread Björn Bartels

this program is giving me *Invalid DN syntax*  error. what's wrong?
cn
for the the user is user

the DN should look like this

cn={username},..., dc={yourdomain}, dc={TLD}

ask your admin for further options...

cheers

Björn Bartels
-Development/IT-Services-

--
dbusiness.de gmbh
digital business  printing gmbh

Greifswalder Str. 152
D-10409 Berlin

Fon: [0.30] 4.21.19.95
Fax: [0.30] 4.21.19.74

www.dbusiness.de
[EMAIL PROTECTED]
ftp://dbusiness.dyndns.org


Björn Bartels
-Development/IT-Services-

--
dbusiness.de gmbh
digital business  printing gmbh

Greifswalder Str. 152
D-10409 Berlin

Fon: [0.30] 4.21.19.95
Fax: [0.30] 4.21.19.74

www.dbusiness.de
[EMAIL PROTECTED]
ftp://dbusiness.dyndns.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Fwd: Re: [PHP] Re: php ldap] soory...

2005-08-26 Thread Björn Bartels
this program is giving me *Invalid DN syntax*  error. what's wrong?
cn
for the the user is user

the DN should look like this

uid={username},..., dc={yourdomain}, dc={TLD}

ask your admin for further options...

cheers

Björn Bartels
-Development/IT-Services-

--
dbusiness.de gmbh
digital business  printing gmbh

Greifswalder Str. 152
D-10409 Berlin

Fon: [0.30] 4.21.19.95
Fax: [0.30] 4.21.19.74

www.dbusiness.de
[EMAIL PROTECTED]
ftp://dbusiness.dyndns.org


Björn Bartels
-Development/IT-Services-

--
dbusiness.de gmbh
digital business  printing gmbh

Greifswalder Str. 152
D-10409 Berlin

Fon: [0.30] 4.21.19.95
Fax: [0.30] 4.21.19.74

www.dbusiness.de
[EMAIL PROTECTED]
ftp://dbusiness.dyndns.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: php ldap

2005-08-26 Thread Björn Bartels
that looks good, i think you should better use uid instead of cn...
btw, i mentioned some authentication-problem earlier in this list.
take a look at the php-manual  @  ldap_bind()  for a workaround if
the same thing is happening to you (testscript works fine, loginscript
does not !?!)...
You'll find a function there by [EMAIL PROTECTED] which might help you out


So should i give
$ldaprdn = 'cn=user,ou=Users,dc=mydomain,dc=com';


sorry for that delayed reply... being at work now :)

Björn Bartels
-Development/IT-Services-

--
dbusiness.de gmbh
digital business  printing gmbh

Greifswalder Str. 152
D-10409 Berlin

Fon: [0.30] 4.21.19.95
Fax: [0.30] 4.21.19.74

www.dbusiness.de
[EMAIL PROTECTED]
ftp://dbusiness.dyndns.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: php ldap

2005-08-26 Thread Santosh Jambhlikar

thanks bartels,
ldap_bind is working find i just used uid instead of cn. :)


Björn Bartels wrote:


that looks good, i think you should better use uid instead of cn...
btw, i mentioned some authentication-problem earlier in this list.
take a look at the php-manual  @  ldap_bind()  for a workaround if
the same thing is happening to you (testscript works fine, loginscript
does not !?!)...
You'll find a function there by [EMAIL PROTECTED] which might help you out


 


So should i give
$ldaprdn = 'cn=user,ou=Users,dc=mydomain,dc=com';

   



sorry for that delayed reply... being at work now :)

Björn Bartels
-Development/IT-Services-

--
dbusiness.de gmbh
digital business  printing gmbh

Greifswalder Str. 152
D-10409 Berlin

Fon: [0.30] 4.21.19.95
Fax: [0.30] 4.21.19.74

www.dbusiness.de
[EMAIL PROTECTED]
ftp://dbusiness.dyndns.org




 



--
Santosh Jambhlikar
Linux Administrator
Cash-Tech Solutions
Pride Parmar Galaxy, Pune
Maharashtra.
Ph.
O.:- 56052000
ext. 2150

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP LDAP query - need to add Exchange fields

2003-12-22 Thread Phil Dowson
Ben,

I was trying the same thing, but I am not sure you are using the same 
setup as me. My office runs a windows 2000 domain with a Exchange server 
2000 box. All profile information is stored in the windows 2000 domain 
controller, and the exchange server accesses the information from there. 
So it doesnt use its own LDAP. And to make it all the more interesting, 
this script is running on our Intranet, on a FreeBSD 5 box with the 
OpenLDAP client.

The following script will bring back all the fields available in LDAP, 
as long as they are filled out. In this script you need to have a valid 
DOMAIN_USER and a valid DOMAIN_PASS. There are ways to do this 
anonymously, you just need to change the $ldap_bind line to remove the 
$ldaprdn and $ldappass.

To change the search criteria, you can change the $filter variable, at 
the moment it filters on the domain user's userid, or samaccountname.

At the bottom of this post, I have included search results based on my 
user, I have removed everything except the fields you might want.

?
$ldapuser = DOMAIN_USER;
$ldappass = DOMAIN_PASS;
$ldaprdn  = 'DOMAIN\\'.$ldapuser;
$ldapconn = @ldap_connect(dns.domain.com, 3268);
@ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
if ($ldapconn) {
$ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass);
}
$base_dn = DC=dns,DC=domain,DC=com;
$filter=samaccountname=$ldapuser;
$read = ldap_search($ldapconn, $base_dn, $filter);
$info = ldap_get_entries($ldapconn, $read);
$ii=0;
for ($i=0; $ii$info[$i][count]; $ii++){
$data = $info[$i][$ii];
echo $data.:nbsp;nbsp;.$info[$i][$data][0].br;
}
?
Hope it helps

Phil Dowson

Ben Crothers wrote:
Hoping this is an easy question to answer, apologise upfront if this is so
basic, but just been put in charge of a PHP app with LDAP interface to M$
Exchange, and trying to figure out how it works.
At the moment it works fine and extracts fields like first- and surname,
title, department, etc. I need to add the 'office' field, and added it at
the end of this filter line:
---
 $filter =
(|(sn=$search[$i]*)(givenname=$search[$i]*)(title=$search[$i]*)(department=
$search[$i]*)(office=$search[$i]*));

...but so far it's not working. I *know* there's data in the 'office'
field -- any ideas as to what I'm missing?
Thanks a lot in advance,

Ben

---Field List---

homemdb:
manager:
memberof:
altrecipientbl:
publicdelegatesbl:
streetaddress:
info:
cn:
company:
c:
department:
description:
displayname:
mail:
facsimiletelephonenumber:
givenname:
initials:
instancetype:
legacyexchangedn:
l:
distinguishedname:
objectcategory:
objectclass:
objectguid:
objectsid:
homephone:
mobile:
pager:
physicaldeliveryofficename:
postofficebox:
postalcode:
primarygroupid:
proxyaddresses:
name:
samaccountname:
samaccounttype:
showinaddressbook:
st:
sn:
telephonenumber:
co:
textencodedoraddress:
title:
useraccountcontrol:
userprincipalname:
usnchanged:
usncreated:
whenchanged:
whencreated:
wwwhomepage:
mailnickname:
msexchuseraccountcontrol:
deliverandredirect:
homemta:
msexchhomeservername:
msexchmailboxguid:
msexchmailboxsecuritydescriptor:
mdbusedefaults:
protocolsettings:

---Field List---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php