Ldap :-( Hallo also ich habe folgendes script zur überprüfung ob ein user in einer bestimmten ldap gruppe vorhanden ist:
************************************************** ***********
// verwenden von ldap bind
$ldaprdn = $user; // ldap rdn oder dn
$ldappass = $pass; // entsprechendes password
$NTdomain = "RBAMOUSER";
$queryuserdn = $NTdomain . "\\" . $ldaprdn;
$location = "emea";
// verbinden zum ldap server
$ldapconn = ldap_connect("rbamsroot01.roche.com")
or die("Keine Verbindung zum LDAP server möglich.");
if ($ldapconn) {
// binden zum ldap server
$ldapbind = ldap_bind($ldapconn, $queryuserdn, $ldappass);
// Bindung überpfrüfen
if ($ldapbind) {
echo "LDAP bind erfolgreich...";
$basedn = "DC=" . $location . ",DC=roche,DC=com";
$information=array("distinguishedName");
$adgroup = "cn=RBA MabThera_LyFE_Online_Booking_Tool,ou=Groups,dc=Roc he,dc=COM";
$sr = ldap_search($ldapconn, $basedn, "(&(objectCategory=user)(CN=$ldaprdn))",$informati on);
$info = ldap_get_entries($ldapconn, $sr);
$zahl= count($info);
print $zahl;
print "
";
if ($zahl > 0)
{
// Get the right values declared in the information array out of the temporary array
if(is_array($information)){
while (list ($key, $val) = each ($information)){
print $val; print "
";
$userdn = $info[0]["$val"][0];
print $userdn;
// now check if user is member of $adgroup
$sr2=@ldap_search($ldapconn, $adgroup, "member=". $userdn, $information);
print $sr2;
// Get all the information into an array
$info2 = @ldap_get_entries($ldapconn, $sr2);
print $info2;
if (isset($info2)) {
$success= 1;
.... da kommt dann noch mehr .....
************************************************** ***********
auf jeden fall besteht folgendes problem, dass script läuft bis zur rot markierten stelle richtig ab, dort funzt dann irgend was nicht mehr und alles was danach kommt geht gar nicht mehr ich kann die variabel $userdn auch gar nicht ausgeben. Hat irgend jemand ne ahnung was da nicht stimmt ? |