Projet

Général

Profil

Révision 91af538d

Ajouté par Assos Assos il y a environ 3 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.functions.inc
8 8
/**
9 9
 * Modify an LDAP Entry.
10 10
 *
11
 * This has been depracated in favor or $ldap_server->modifyLdapEntry($dn, $attributes)
12
 * which handles empty attributes better.
11
 * @deprecated This has been deprecated in favor of
12
 * `$ldap_server->modifyLdapEntry($dn, $attributes)` which handles empty
13
 * attributes better.
13 14
 */
14 15
function ldap_user_modify($dn, $attributes, $ldap_server) {
15 16
  $result = ldap_modify($ldap_server->connection, $dn, $attributes);
16 17
  if (!$result) {
17
    $error = "LDAP Server ldap_modify(%dn) in ldap_user_modify() Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
18
    $tokens = ['%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection))];
18
    $error = "LDAP Server ldap_modify(%dn) in ldap_user_modify(), LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
19
    $tokens = ['%dn' => $dn, '%ldap_errno' => ldap_errno($ldap_server->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($ldap_server->connection))];
19 20
    watchdog('ldap_servers', $error, $tokens, WATCHDOG_ERROR);
20 21
  }
21 22
  return $result;
......
30 31
  $len = drupal_strlen($new_password);
31 32
  $new_pass = NULL;
32 33
  for ($i = 0; $i < $len; $i++) {
33
    $new_pass .= "{$new_password{$i}}\000";
34
    $new_pass .= "{$new_password[$i]}\000";
34 35
  }
35 36

  
36 37
  $status = ldap_mod_replace($ldap_server->connection, $userdn, ['unicodePwd' => $new_pass]);
......
416 417
 * @return string
417 418
 */
418 419
function ldap_pear_hex2asc($string) {
419

  
420
  if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
421
    $string = preg_replace_callback(
420
  $string = preg_replace_callback(
422 421
    "/\\\([0-9A-Fa-f]{2})/",
423 422
    function ($m) {
424 423
      return chr(hexdec($m[1]));
425 424
    },
426
        $string);
427
  }
428
  else {
429
    $string = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''", $string);
430
  }
431

  
425
    $string
426
  );
432 427
  return $string;
433 428
}
434 429

  

Formats disponibles : Unified diff