Koozali.org: home of the SME Server

ldap code (php) works on NDS,W2K but not SME

Sam Russo

ldap code (php) works on NDS,W2K but not SME
« on: December 26, 2002, 05:21:46 AM »
Hi all, I'm trying to get ldap authentication working on SME5.5
The following code works on Novells LDAP and w2k ldap but not SME.
I'm sure the problem is in the $dn line since it actually connects to the me Ldap server
Any help would be appreciated:

Untitled


$ip = "192.168.1.1";
// in SME's admin ldap panel it has:
//Server root dc=samsite,dc=nsw,dc=edu,dc=au
//... so I try:
$dn="cn=sam,dc=samsite,dc=nsw,dc=edu,dc=au";
$password="letmein";      
   
if (!($ldap = ldap_connect($ip,389))) {
     die ("Could not connect to LDAP server");
}

print "connected to $ip
";

if (!($res = @ldap_bind($ldap, $dn, $password))) {  
    print "Sorry could not log you in
";
    print "Try Login Again
";
    exit;
}
// ############ YOUR LOGGED IN ######
print "user $dn authenticated.
";

?>