40 public $errors = array();
104 public $ldapcharset =
'UTF-8';
125 if (!empty($conf->global->LDAP_SERVER_HOST)) $this->server[] = $conf->global->LDAP_SERVER_HOST;
126 if (!empty($conf->global->LDAP_SERVER_HOST_SLAVE)) $this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE;
127 $this->serverPort = $conf->global->LDAP_SERVER_PORT;
128 $this->ldapProtocolVersion = $conf->global->LDAP_SERVER_PROTOCOLVERSION;
129 $this->dn = $conf->global->LDAP_SERVER_DN;
130 $this->serverType = $conf->global->LDAP_SERVER_TYPE;
131 $this->domain = $conf->global->LDAP_SERVER_DN;
132 $this->searchUser = $conf->global->LDAP_ADMIN_DN;
133 $this->searchPassword = $conf->global->LDAP_ADMIN_PASS;
134 $this->people = $conf->global->LDAP_USER_DN;
135 $this->groups = $conf->global->LDAP_GROUP_DN;
137 $this->filter = $conf->global->LDAP_FILTER_CONNECTION;
138 $this->filtermember = $conf->global->LDAP_MEMBER_FILTER;
141 $this->attr_login = $conf->global->LDAP_FIELD_LOGIN;
142 $this->attr_sambalogin = $conf->global->LDAP_FIELD_LOGIN_SAMBA;
143 $this->attr_name = $conf->global->LDAP_FIELD_NAME;
144 $this->attr_firstname = $conf->global->LDAP_FIELD_FIRSTNAME;
145 $this->attr_mail = $conf->global->LDAP_FIELD_MAIL;
146 $this->attr_phone = $conf->global->LDAP_FIELD_PHONE;
147 $this->attr_skype = $conf->global->LDAP_FIELD_SKYPE;
148 $this->attr_fax = $conf->global->LDAP_FIELD_FAX;
149 $this->attr_mobile = $conf->global->LDAP_FIELD_MOBILE;
173 if (count($this->server) == 0 || empty($this->server[0]))
175 $this->error =
'LDAP setup (file conf.php) is not complete';
176 dol_syslog(get_class($this).
"::connect_bind ".$this->error, LOG_WARNING);
180 if (!function_exists(
"ldap_connect"))
182 $this->error =
'LDAPFunctionsNotAvailableOnPHP';
183 dol_syslog(get_class($this).
"::connect_bind ".$this->error, LOG_WARNING);
187 if (empty($this->error))
190 foreach ($this->server as $host)
192 if ($connected)
break;
193 if (empty($host))
continue;
195 if ($this->
serverPing($host, $this->serverPort) ===
true) {
196 $this->connection = ldap_connect($host, $this->serverPort);
199 if (is_resource($this->connection))
202 if (!empty($conf->global->LDAP_SERVER_USE_TLS))
204 if (!ldap_start_tls($this->connection))
206 dol_syslog(get_class($this).
"::connect_bind failed to start tls", LOG_WARNING);
214 ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0);
217 if ($this->serverType ==
"activedirectory")
220 dol_syslog(get_class($this).
"::connect_bind try bindauth for activedirectory on ".$host.
" user=".$this->searchUser.
" password=".preg_replace(
'/./',
'*', $this->searchPassword), LOG_DEBUG);
221 $this->result = $this->
bindauth($this->searchUser, $this->searchPassword);
228 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
232 if ($this->searchUser && $this->searchPassword)
234 dol_syslog(get_class($this).
"::connect_bind try bindauth on ".$host.
" user=".$this->searchUser.
" password=".preg_replace(
'/./',
'*', $this->searchPassword), LOG_DEBUG);
235 $this->result = $this->
bindauth($this->searchUser, $this->searchPassword);
242 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
248 dol_syslog(get_class($this).
"::connect_bind try bind on ".$host, LOG_DEBUG);
256 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
262 if (!$connected) $this->
close();
268 $return = $connected;
269 dol_syslog(get_class($this).
"::connect_bind return=".$return, LOG_DEBUG);
271 $this->error =
'Failed to connect to LDAP'.($this->error ?
': '.$this->error :
'');
273 dol_syslog(get_class($this).
"::connect_bind return=".$return.
' - '.$this->error, LOG_WARNING);
288 if ($this->connection && !@ldap_close($this->connection))
304 if (!$this->result = @ldap_bind($this->connection))
306 $this->ldapErrorCode = ldap_errno($this->connection);
307 $this->ldapErrorText = ldap_error($this->connection);
327 if (!$this->result = @ldap_bind($this->connection, $bindDn, $pass))
329 $this->ldapErrorCode = ldap_errno($this->connection);
330 $this->ldapErrorText = ldap_error($this->connection);
345 if (!$this->result = @ldap_unbind($this->connection))
362 $version = @ldap_get_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $version);
374 $ldapsetversion = ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldapProtocolVersion);
375 return $ldapsetversion;
386 $ldapreferrals = ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0);
387 return $ldapreferrals;
402 dol_syslog(get_class($this).
"::add dn=".
$dn.
" info=".join(
',', $info));
405 if (!$this->connection)
407 $this->error =
"NotConnected";
412 $this->error =
"NotConnected";
418 foreach ($info as $key => $val)
426 $result = @ldap_add($this->connection,
$dn, $info);
430 dol_syslog(get_class($this).
"::add successfull", LOG_DEBUG);
433 $this->ldapErrorCode = @ldap_errno($this->connection);
434 $this->ldapErrorText = @ldap_error($this->connection);
436 dol_syslog(get_class($this).
"::add failed: ".$this->error, LOG_ERR);
452 dol_syslog(get_class($this).
"::modify dn=".
$dn.
" info=".join(
',', $info));
455 if (!$this->connection)
457 $this->error =
"NotConnected";
462 $this->error =
"NotConnected";
468 foreach ($info as $key => $val)
478 if ($this->serverType ==
"activedirectory") {
481 $result = @ldap_modify($this->connection,
$dn, $info);
485 dol_syslog(get_class($this).
"::modify successfull", LOG_DEBUG);
488 $this->error = @ldap_error($this->connection);
489 dol_syslog(get_class($this).
"::modify failed: ".$this->error, LOG_ERR);
505 public function rename(
$dn, $newrdn, $newparent, $user, $deleteoldrdn =
true)
507 dol_syslog(get_class($this).
"::modify dn=".
$dn.
" newrdn=".$newrdn.
" newparent=".$newparent.
" deleteoldrdn=".($deleteoldrdn ? 1 : 0));
510 if (!$this->connection)
512 $this->error =
"NotConnected";
517 $this->error =
"NotConnected";
527 $result = @ldap_rename($this->connection,
$dn, $newrdn, $newparent, $deleteoldrdn);
531 dol_syslog(get_class($this).
"::rename successfull", LOG_DEBUG);
534 $this->error = @ldap_error($this->connection);
535 dol_syslog(get_class($this).
"::rename failed: ".$this->error, LOG_ERR);
552 public function update(
$dn, $info, $user, $olddn, $newrdn =
false, $newparent =
false)
554 dol_syslog(get_class($this).
"::update dn=".
$dn.
" olddn=".$olddn);
557 if (!$this->connection)
559 $this->error =
"NotConnected";
564 $this->error =
"NotConnected";
568 if (!$olddn || $olddn !=
$dn)
570 if (!empty($olddn) && !empty($newrdn) && !empty($newparent) && $this->ldapProtocolVersion ===
'3')
573 $result = $this->
rename($olddn, $newrdn, $newparent, $user,
true);
587 $this->error = ldap_error($this->connection).
' (Code '.ldap_errno($this->connection).
") ".$this->error;
588 dol_syslog(get_class($this).
"::update ".$this->error, LOG_ERR);
592 dol_syslog(get_class($this).
"::update done successfully");
605 public function delete(
$dn)
607 dol_syslog(get_class($this).
"::delete Delete LDAP entry dn=".
$dn);
610 if (!$this->connection)
612 $this->error =
"NotConnected";
617 $this->error =
"NotConnected";
624 $result = @ldap_delete($this->connection, $dn);
644 if (preg_match(
'/^ldap/', $this->server[0]))
646 $target =
"-H ".join(
',', $this->server);
648 $target =
"-h ".join(
',', $this->server).
" -p ".$this->serverPort;
650 $content .=
"# ldapadd $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
651 $content .=
"# ldapmodify $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
652 $content .=
"# ldapdelete $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
653 if (in_array(
'localhost', $this->server)) $content .=
"# If commands fails to connect, try without -h and -p\n";
654 $content .=
"dn: ".$dn.
"\n";
655 foreach ($info as $key => $value)
657 if (!is_array($value))
659 $content .=
"$key: $value\n";
661 foreach ($value as $valuevalue)
663 $content .=
"$key: $valuevalue\n";
687 $outputfile = $conf->ldap->dir_temp.
'/ldapinput.in';
688 $fp = fopen($outputfile,
"w");
691 fputs($fp, $content);
693 if (!empty($conf->global->MAIN_UMASK))
694 @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
712 if (preg_match(
'/^ldaps:\/\/([^\/]+)\/?$/', $host, $regs)) {
713 $host =
'ssl://'.$regs[1];
716 if (preg_match(
'/^ldap:\/\/([^\/]+)\/?$/', $host, $regs)) {
719 $op = @fsockopen($host, $port, $errno, $errstr, $timeout);
720 if (!$op)
return false;
741 dol_syslog(get_class($this).
"::addAttribute dn=".
$dn.
" info=".join(
',', $info));
744 if (!$this->connection)
746 $this->error =
"NotConnected";
751 $this->error =
"NotConnected";
757 foreach ($info as $key => $val)
765 $result = @ldap_mod_add($this->connection,
$dn, $info);
769 dol_syslog(get_class($this).
"::add_attribute successfull", LOG_DEBUG);
772 $this->error = @ldap_error($this->connection);
773 dol_syslog(get_class($this).
"::add_attribute failed: ".$this->error, LOG_ERR);
789 dol_syslog(get_class($this).
"::updateAttribute dn=".
$dn.
" info=".join(
',', $info));
792 if (!$this->connection)
794 $this->error =
"NotConnected";
799 $this->error =
"NotConnected";
805 foreach ($info as $key => $val)
813 $result = @ldap_mod_replace($this->connection,
$dn, $info);
817 dol_syslog(get_class($this).
"::updateAttribute successfull", LOG_DEBUG);
820 $this->error = @ldap_error($this->connection);
821 dol_syslog(get_class($this).
"::updateAttribute failed: ".$this->error, LOG_ERR);
837 dol_syslog(get_class($this).
"::deleteAttribute dn=".
$dn.
" info=".join(
',', $info));
840 if (!$this->connection)
842 $this->error =
"NotConnected";
847 $this->error =
"NotConnected";
853 foreach ($info as $key => $val)
861 $result = @ldap_mod_del($this->connection,
$dn, $info);
865 dol_syslog(get_class($this).
"::deleteAttribute successfull", LOG_DEBUG);
868 $this->error = @ldap_error($this->connection);
869 dol_syslog(get_class($this).
"::deleteAttribute failed: ".$this->error, LOG_ERR);
884 if (!$this->connection)
886 $this->error =
"NotConnected";
891 $this->error =
"NotConnected";
895 $search = ldap_search($this->connection,
$dn, $filter);
898 $entry = ldap_first_entry($this->connection, $search);
902 $this->ldapErrorCode = -1;
903 $this->ldapErrorText =
"Couldn't find entry";
908 if (!($values = ldap_get_attributes($this->connection, $entry)))
910 $this->ldapErrorCode = ldap_errno($this->connection);
911 $this->ldapErrorText = ldap_error($this->connection);
928 $attributes = array();
929 $attributes[0] = $attribute;
932 $this->result = @ldap_search($this->connection, $this->people, $filterrecord, $attributes);
938 $entry = ldap_first_entry($this->connection, $this->result);
942 $this->ldapErrorCode = -1;
943 $this->ldapErrorText =
"Couldn't find user";
948 if (!$values = @ldap_get_values($this->connection, $entry, $attribute))
950 $this->ldapErrorCode = ldap_errno($this->connection);
951 $this->ldapErrorText = ldap_error($this->connection);
971 public function getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter = 0, $attributeAsArray = array())
975 dol_syslog(get_class($this).
"::getRecords search=".$search.
" userDn=".$userDn.
" useridentifier=".$useridentifier.
" attributeArray=array(".join(
',', $attributeArray).
") activefilter=".$activefilter);
978 if ($this->serverType ==
"activedirectory")
980 $this->
bindauth($this->searchUser, $this->searchPassword);
981 dol_syslog(get_class($this).
"::bindauth serverType=activedirectory searchUser=".$this->searchUser);
985 if (!empty($activefilter))
987 if (((
string) $activefilter ==
'1' || (
string) $activefilter ==
'user') && $this->filter) {
988 $filter =
'('.$this->filter.
')';
989 } elseif (((
string) $activefilter ==
'member') && $this->filter) {
990 $filter =
'('.$this->filtermember.
')';
993 $filter =
'('.$useridentifier.
'=*)';
996 $filter =
'('.$useridentifier.
'='.$search.
')';
999 if (is_array($attributeArray))
1002 $attributeArray = array_values($attributeArray);
1003 dol_syslog(get_class($this).
"::getRecords connection=".$this->connection.
" userDn=".$userDn.
" filter=".$filter.
" attributeArray=(".join(
',', $attributeArray).
")");
1005 $this->result = @ldap_search($this->connection, $userDn, $filter, $attributeArray);
1008 dol_syslog(get_class($this).
"::getRecords connection=".$this->connection.
" userDn=".$userDn.
" filter=".$filter);
1009 $this->result = @ldap_search($this->connection, $userDn, $filter);
1013 $this->error =
'LDAP search failed: '.ldap_errno($this->connection).
" ".ldap_error($this->connection);
1017 $info = @ldap_get_entries($this->connection, $this->result);
1023 for ($i = 0; $i < $info[
"count"]; $i++)
1025 $recordid = $this->
convToOutputCharset($info[$i][$useridentifier][0], $this->ldapcharset);
1029 $fulllist[$recordid][$useridentifier] = $recordid;
1032 $num = count($attributeArray);
1033 for ($j = 0; $j < $num; $j++)
1035 $keyattributelower = strtolower($attributeArray[$j]);
1039 if ($this->serverType ==
"activedirectory" && $keyattributelower ==
"objectsid")
1042 $fulllist[$recordid][$attributeArray[$j]] = $objectsid;
1044 if (in_array($attributeArray[$j], $attributeAsArray) && is_array($info[$i][$keyattributelower])) {
1045 $valueTab = array();
1046 foreach ($info[$i][$keyattributelower] as $key => $value) {
1049 $fulllist[$recordid][$attributeArray[$j]] = $valueTab;
1051 $fulllist[$recordid][$attributeArray[$j]] = $this->
convToOutputCharset($info[$i][$keyattributelower][0], $this->ldapcharset);
1072 for ($x =
dol_strlen($hex) - 2; $x >= 0; $x = $x - 2) {
1073 $result .= substr($hex, $x, 2);
1088 $criteria =
'('.$this->getUserIdentifier().
'='.$ldapUser.
')';
1089 $justthese = array(
"objectsid");
1092 if ($this->serverType ==
"activedirectory")
1094 $this->
bindauth($this->searchUser, $this->searchPassword);
1102 $ldapSearchResult = @ldap_search($this->connection, $searchDN, $criteria, $justthese);
1104 if (!$ldapSearchResult)
1106 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1110 $entry = ldap_first_entry($this->connection, $ldapSearchResult);
1125 $ldapBinary = ldap_get_values_len($this->connection, $entry,
"objectsid");
1129 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1143 $hex_sid = bin2hex($binsid);
1144 $rev = hexdec(substr($hex_sid, 0, 2));
1145 $subcount = hexdec(substr($hex_sid, 2, 2));
1146 $auth = hexdec(substr($hex_sid, 4, 12));
1148 for ($x = 0; $x < $subcount; $x++)
1169 dol_syslog(get_class($this).
"::search checkDn=".$checkDn.
" filter=".$filter);
1175 if ($this->serverType ==
"activedirectory") {
1176 $this->
bindauth($this->searchUser, $this->searchPassword);
1179 $this->result = @ldap_search($this->connection, $checkDn, $filter);
1181 $result = @ldap_get_entries($this->connection, $this->result);
1184 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1187 ldap_free_result($this->result);
1206 if ($this->serverType ==
"activedirectory") {
1207 $this->
bindauth($this->searchUser, $this->searchPassword);
1216 dol_syslog(get_class($this).
"::fetch search with searchDN=".$searchDN.
" filter=".$filter);
1217 $this->result = @ldap_search($this->connection, $searchDN, $filter);
1220 $result = @ldap_get_entries($this->connection, $this->result);
1222 else dol_syslog(
'Ldap::fetch search returns but found no records');
1225 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1226 dol_syslog(get_class($this).
"::fetch search fails");
1242 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1255 if (isset(
$result[0][
"pwdlastset"][0]))
1259 $this->pwdlastset = -1;
1261 if (!$this->
name && !$this->login) $this->pwdlastset = -1;
1265 $domain = str_replace(
'dc=',
'', $this->domain);
1271 $this->ldapUserDN =
$result[0][
'dn'];
1273 ldap_free_result($this->result);
1288 if ($this->serverType ==
"activedirectory") {
1289 return $this->attr_sambalogin;
1291 return $this->attr_login;
1305 "TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216,
1306 "PASSWORD_EXPIRED" => 8388608,
1307 "DONT_REQ_PREAUTH" => 4194304,
1308 "USE_DES_KEY_ONLY" => 2097152,
1309 "NOT_DELEGATED" => 1048576,
1310 "TRUSTED_FOR_DELEGATION" => 524288,
1311 "SMARTCARD_REQUIRED" => 262144,
1312 "MNS_LOGON_ACCOUNT" => 131072,
1313 "DONT_EXPIRE_PASSWORD" => 65536,
1314 "SERVER_TRUST_ACCOUNT" => 8192,
1315 "WORKSTATION_TRUST_ACCOUNT" => 4096,
1316 "INTERDOMAIN_TRUST_ACCOUNT" => 2048,
1317 "NORMAL_ACCOUNT" => 512,
1318 "TEMP_DUPLICATE_ACCOUNT" => 256,
1319 "ENCRYPTED_TEXT_PWD_ALLOWED" => 128,
1320 "PASSWD_CANT_CHANGE" => 64,
1321 "PASSWD_NOTREQD" => 32,
1323 "HOMEDIR_REQUIRED" => 8,
1324 "ACCOUNTDISABLE" => 2,
1331 foreach ($flags as $flag => $val) {
1332 if ($uacf >= $val) {
1334 $retval[$val] = $flag;
1351 805306368 =>
"NORMAL_ACCOUNT",
1352 805306369 =>
"WORKSTATION_TRUST",
1353 805306370 =>
"INTERDOMAIN_TRUST",
1354 268435456 =>
"SECURITY_GLOBAL_GROUP",
1355 268435457 =>
"DISTRIBUTION_GROUP",
1356 536870912 =>
"SECURITY_LOCAL_GROUP",
1357 536870913 =>
"DISTRIBUTION_LOCAL_GROUP"
1361 while (list($sat, $val) = each($stypes)) {
1362 if ($samtype == $sat) {
1367 if (empty($retval)) $retval =
"UNKNOWN_TYPE_".$samtype;
1382 $dateLargeInt = $value;
1383 $secsAfterADEpoch = $dateLargeInt / (10000000);
1384 $ADToUnixConvertor = ((1970 - 1601) * 365.242190) * 86400;
1385 $unixTimeStamp = intval($secsAfterADEpoch - $ADToUnixConvertor);
1386 return $unixTimeStamp;
1400 if ($pagecodefrom ==
'ISO-8859-1' && $conf->file->character_set_client ==
'UTF-8') $str = utf8_encode($str);
1401 if ($pagecodefrom ==
'UTF-8' && $conf->file->character_set_client ==
'ISO-8859-1') $str = utf8_decode($str);
1415 if ($pagecodeto ==
'ISO-8859-1' && $conf->file->character_set_client ==
'UTF-8') $str = utf8_decode($str);
1416 if ($pagecodeto ==
'UTF-8' && $conf->file->character_set_client ==
'ISO-8859-1') $str = utf8_encode($str);
1431 if (empty($keygroup)) $keygroup =
'LDAP_KEY_GROUPS';
1433 $search =
'('.$conf->global->$keygroup.
'=*)';
1439 for ($i = 0; $i < $c; $i++)
1441 $gids[] =
$result[$i][
'gidnumber'][0];
1445 return $gids[0] + 1;
setReferrals()
changement du referrals.
deleteAttribute($dn, $info, $user)
Delete a LDAP attribute in entry Ldap object connect and bind must have been done.
getNextGroupGid($keygroup= 'LDAP_KEY_GROUPS')
Return available value of group GID.
update($dn, $info, $user, $olddn, $newrdn=false, $newparent=false)
Modify a LDAP entry (to use if dn != olddn) Ldap object connect and bind must have been done...
addAttribute($dn, $info, $user)
Add a LDAP attribute in entry Ldap object connect and bind must have been done.
binSIDtoText($binsid)
Returns the textual SID Indispensable pour Active Directory.
add($dn, $info, $user)
Add a LDAP entry Ldap object connect and bind must have been done.
modify($dn, $info, $user)
Modify a LDAP entry Ldap object connect and bind must have been done.
getVersion()
Verification de la version du serveur ldap.
$ldapErrorCode
Code erreur retourne par le serveur Ldap.
getAttribute($dn, $filter)
Returns an array containing attributes and values for first record.
$searchUser
User administrateur Ldap Active Directory ne supporte pas les connexions anonymes.
$ldapErrorText
Message texte de l'erreur.
getAttributeValues($filterrecord, $attribute)
Returns an array containing values for an attribute and for first record matching filterrecord...
unbind()
Unbind du serveur ldap.
$conf db name
Only used if Module[ID]Name translation string is not found.
bind()
Anonymously binds to the connection.
parseUACF($uacf)
UserAccountControl Flgs to more human understandable form...
convFromOutputCharset($str, $pagecodeto= 'UTF-8')
Convert a string from output/memory charset.
convert_time($value)
Convertit le temps ActiveDirectory en Unix timestamp.
$ldapProtocolVersion
Version du protocole ldap.
updateAttribute($dn, $info, $user)
Update a LDAP attribute in entry Ldap object connect and bind must have been done.
$people
DN des utilisateurs.
$searchPassword
Mot de passe de l'administrateur Active Directory ne supporte pas les connexions anonymes.
$result
Result of any connections etc.
convToOutputCharset($str, $pagecodefrom= 'UTF-8')
Convert a string into output/memory charset.
dump($dn, $info)
Dump a LDAP message to ldapinput.in file.
serverPing($host, $port=389, $timeout=1)
Ping a server before ldap_connect for avoid waiting.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
dump_content($dn, $info)
Build a LDAP message.
bindauth($bindDn, $pass)
Binds as an authenticated user, which usually allows for write access.
getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter=0, $attributeAsArray=array())
Returns an array containing a details or list of LDAP record(s) ldapsearch -LLLx -hlocalhost -Dcn=adm...
parseSAT($samtype)
SamAccountType value to text.
__construct()
Constructor.
search($checkDn, $filter)
Fonction de recherche avec filtre this->connection doit etre defini donc la methode bind ou bindauth d...
littleEndian($hex)
Converts a little-endian hex-number to one, that 'hexdec' can convert Required by Active Directory...
Class to manage LDAP features.
close()
Simply closes the connection set up earlier.
rename($dn, $newrdn, $newparent, $user, $deleteoldrdn=true)
Rename a LDAP entry Ldap object connect and bind must have been done.
fetch($user, $filter)
Load all attribute of a LDAP user.
setVersion()
Change ldap protocol version to use.
getObjectSid($ldapUser)
Recupere le SID de l'utilisateur Required by Active Directory.
$server
Tableau des serveurs (IP addresses ou nom d'hotes)
getUserIdentifier()
Returns the correct user identifier to use, based on the ldap server type.
$connection
The internal LDAP connection handle.
$serverType
type de serveur, actuellement OpenLdap et Active Directory
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)
connect_bind()
Connect and bind Use this->server, this->serverPort, this->ldapProtocolVersion, this->serverType, this->searchUser, this->searchPassword After return, this->connection and $this->bind are defined.