Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo,

ich bastel mir grad eine LDAP Authentifizierung.

Wenn ich mir jedoch per ldap_get_entries die einträge für den jeweiligen Nutzer holen möchte werden mir alle Attribute bis auf "userpassword" ausgegeben, sprich genau die Variable die mich am meisten interessiert. Hier mal mein Script und danach die ausgabe


<?php

echo "<h3>LDAP query test</h3>";
echo "Connecting ...";
$ds=ldap_connect("127.0.0.1");
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
echo "connect result is " . $ds . "<br />";

if ($ds) {
echo "Binding ...";
$r=ldap_bind($ds); // anonymous bind
echo "Bind result is " . $r . "<br />";
echo "Searching for (sn=S*) ...";
$sr=ldap_search($ds, "ou=Users, dc=xxx, dc=de", "cn=user1");
echo "Search result is " . $sr . "<br />";
echo "Number of entires returned is " . ldap_count_entries($ds, $sr) . "<br />";
echo "Getting entries ...<p>";
$info = ldap_get_entries($ds, $sr);
echo "Data for " . $info["count"] . " items returned:<p>";
for ($i=0; $i<$info["count"]; $i++) {
print_r ($info[0]);
}
echo "Closing connection";
ldap_close($ds);

} else {
echo "<h4>Unable to connect to LDAP server</h4>";
}
?>
[/PHP]

[PHP]
LDAP query test
Connecting ...connect result is Resource id #1
Binding ...Bind result is 1
Searching for (sn=S*) ...Search result is Resource id #2
Number of entires returned is 1
Getting entries ...

Data for 1 items returned:

Array ( [uid] => Array ( [count] => 1 [0] => user1 ) [0] => uid [sn] => Array ( [count] => 1 [0] => Benutzer eins ) [1] => sn [cn] => Array ( [count] => 1 [0] => user1 ) [2] => cn [objectclass] => Array ( [count] => 2 [0] => inetOrgPerson [1] => top ) [3] => objectclass [count] => 4 [dn] => cn=user1,ou=Users,dc=xxx,dc=de ) Closing connection

das Attrubut "userpassword" gibt es zu 100%, das habe ich per phpldapadmin überprüft

kann doch eigentlich auch nicht daran liegen, dass es ein anonymous Bind ist

Wer weiß weiter?

Danke!

Hallo,

je nachdem wie die Konfig des LDAP Server ist, ist das Feld Userpasswort nur als Root und als Benutzer des Eintrages zugänglich. Du müsstest Dich, um an den Inhalt des Feldes zu kommen als Root bzw User binden. Persönlich rate ich Dir von einer BindDN mit Root ab.

Verbinde Dich als User, wenn das fehl schlägt, stimmt der Login nicht, wenn es klappt ist der Login korrekt und Du kannst das Feld auslesen

HTH Phil

is natürlich auch ne gute idee

und funktioniert sogar noch :-)

danke

im nachhinein auch irgendwie logisch...wenn jeder tro**el über nen anonymous bind an alle userinfos inkl passworthashes kommt...

  • 11 Monate später...

Wie würde denn der Quelli aussehen, wenn ein Benutzerkonto und PW hinterlegt ist?

mfg

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.