Skip to content
Snippets Groups Projects
Commit 09b4102c authored by Martin Haase's avatar Martin Haase
Browse files

further merging

git-svn-id: https://textgridlab.org/svn/textgrid/trunk/middleware/tgauth@7750 7c539038-3410-0410-b1ec-0f2a7bf1c452
parent e23136e5
No related branches found
No related tags found
No related merge requests found
...@@ -175,11 +175,28 @@ class LDAP implements iLDAP { ...@@ -175,11 +175,28 @@ class LDAP implements iLDAP {
} }
/*
// ## getBinaryValues ###########################
public function getBinaryValues ( $inDn, $attribute ) {
$arrResult = Array(); // Wanted search result
// Im LDAP suchen funktioniert nur ueber eine
// vorhandene Verbindung.
if( $this->hasConnection ) {
$arrResult = ldap_get_values_len( $this->connection, $inDn, $attribute );
}
return $arrResult;
}
*/
// ## getEntry ###################################################### // ## getEntry ######################################################
public function getEntry( $inDn, Array $inArrAttribute = null ) { public function getEntry( $inDn, Array $inArrAttribute = null , $wantBinaryAttribute = false) {
$ldapSearch = false; // Handle $ldapSearch = false; // Handle
$ldapEntries = Array(); // Unmodified search results $ldapEntries = Array(); // Unmodified search results
...@@ -191,7 +208,7 @@ class LDAP implements iLDAP { ...@@ -191,7 +208,7 @@ class LDAP implements iLDAP {
// vorhandene Verbindung. // vorhandene Verbindung.
if( $this->hasConnection ) { if( $this->hasConnection ) {
if( isset( $this->cache[$inDn] ) ) { if( isset( $this->cache[$inDn] ) && !$wantBinaryAttribute ) {
return $this->cache[$inDn]; return $this->cache[$inDn];
...@@ -215,7 +232,21 @@ class LDAP implements iLDAP { ...@@ -215,7 +232,21 @@ class LDAP implements iLDAP {
if( $ldapSearch ) { if( $ldapSearch ) {
$ldapEntries = ldap_get_entries( $this->connection, $ldapSearch ); if ($wantBinaryAttribute) {
$ldapEntry = ldap_first_entry( $this->connection, $ldapSearch );
for ( $i = 0 ; $i < sizeof ($inArrAttribute); $i++) {
$binEntries = ldap_get_values_len ($this->connection, $ldapEntry, $inArrAttribute[$i] );
unset ( $binEntries['count'] );
$arrResult[$inArrAttribute[$i]] = $binEntries ;
}
} else {
$ldapEntries = ldap_get_entries( $this->connection, $ldapSearch );
}
} }
...@@ -225,31 +256,32 @@ class LDAP implements iLDAP { ...@@ -225,31 +256,32 @@ class LDAP implements iLDAP {
unset( $ldapSearch ); unset( $ldapSearch );
// Ueberfluessige Eintraege entfernen if (!$wantBinaryAttribute) {
$ldapEntries = $this->clean( $ldapEntries );
// Ueberfluessige Eintraege entfernen
$ldapEntries = $this->clean( $ldapEntries );
// Sollte nur ein einziger oder kein Eintrag sein! Dieser
// Eine (oder Keine) wird uebernommen.
for( $i = 0; $i < sizeof( $ldapEntries ); $i++ ) {
// Sollte nur ein einziger oder kein Eintrag sein! Dieser // Das Ergebnis in den Cache schreiben
// Eine (oder Keine) wird uebernommen. $this->cache[$ldapEntries[$i]['dn']] = $ldapEntries[$i];
for( $i = 0; $i < sizeof( $ldapEntries ); $i++ ) {
// Das Ergebnis in den Cache schreiben
$this->cache[$ldapEntries[$i]['dn']] = $ldapEntries[$i];
if( preg_match( "/^" . $ldapEntries[$i]['dn'] . "$/i", $inDn ) ) {
if( preg_match( "/^" . $ldapEntries[$i]['dn'] . "$/i", $inDn ) ) { $arrResult = $ldapEntries[$i];
$arrResult = $ldapEntries[$i]; }
} }
} }
} }
} }
// return array('hallo' => "ballo");
return $arrResult; return $arrResult;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment