Skip to content
Snippets Groups Projects
Commit 6d4dbed0 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Merge branch 'origin/6.x' into 'master'

Origin/6.x

See merge request lib/unicaen/ldap!2
parents 77acdffa a64da0ed
No related branches found
No related tags found
No related merge requests found
......@@ -38,5 +38,6 @@ $ cp -n vendor/unicaen/zimbra/config/unicaen-ldap.local.php.dist config/autoload
'username' => "uid=xxxx,ou=system,dc=unicaen,dc=fr",
'password' => "xxxx",
'accountFilterFormat' => "(&(objectClass=supannPerson)(supannAliasLogin=%s))",
'useStartTls' => false
]
```
\ No newline at end of file
......@@ -10,5 +10,6 @@ return [
'username' => "uid=xxxxxxxxx,ou=xxxxxxxxxx,dc=domain,dc=fr",
'password' => "xxxxxxxxxxxx",
'accountFilterFormat' => "(&(objectClass=posixAccount)(supannAliasLogin=%s))",
'useStartTls' => false
]
];
......@@ -2215,7 +2215,7 @@ class People extends Entity
$uni = '';
$value = (string)$value;
for ($i = 0; $i < strlen($value); $i++) {
$a = ord($value{$i}) << 8;
$a = ord($value[$i]) << 8;
$uni .= sprintf('%X', $a);
}
$nthash = hash("md4", pack('H*', $uni), true);
......@@ -2238,7 +2238,7 @@ class People extends Entity
$uni = '';
$value = (string)$value;
for ($i = 0; $i < strlen($value); $i++) {
$a = ord($value{$i}) << 8;
$a = ord($value[$i]) << 8;
$uni .= sprintf('%X', $a);
}
$nthash = hash("md4", pack('H*', $uni), true);
......
......@@ -67,6 +67,11 @@ class ModuleOptions extends AbstractOptions
*/
protected $accountFilterFormat;
/**
* @var bool
*/
protected $useStartTls;
public function getIterator() {
return new \ArrayIterator($this);
......@@ -244,7 +249,25 @@ class ModuleOptions extends AbstractOptions
*/
public function setAccountFilterFormat($accountFilterFormat)
{
$this->accountFilterFormat = (boolean)$accountFilterFormat;
$this->accountFilterFormat = (string)$accountFilterFormat;
return $this;
}
/**
* @return bool
*/
public function getUseStartTls(): ?bool
{
return $this->useStartTls;
}
/**
* @param bool $useStartTls
* @return $this
*/
public function setUseStartTls(bool $useStartTls): ModuleOptions
{
$this->useStartTls = $useStartTls;
return $this;
}
......@@ -262,6 +285,7 @@ class ModuleOptions extends AbstractOptions
'password' => $this->getPassword(),
'bindRequiresDn' => $this->getBindRequiresDn(),
'baseDn' => $this->getBaseDn(),
'useStartTls' => $this->getUseStartTls(),
);
}
}
\ No newline at end of file
......@@ -303,8 +303,10 @@ abstract class AbstractService implements
$filter = $ouFilter . ")$filter)";
}
$resource = $this->getLdap()->getResource();
ErrorHandler::start(E_WARNING);
if (null === $attributes) $search = ldap_search($resource, $basedn, $filter);
else $search = ldap_search($resource, $basedn, $filter, $attributes);
ErrorHandler::stop();
if ($search === false) {
throw new Exception('searching: ' . $filter);
}
......
......@@ -10,5 +10,6 @@ return array(
'username' => "uid=applidev,ou=system,dc=unicaen,dc=fr",
'password' => "***REMOVED***",
'accountFilterFormat' => "(&(objectClass=posixAccount)(supannAliasLogin=%s))",
'useStartTls' => false
)
);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment