Skip to content

Commit 6694997

Browse files
Merge branch '4.4' into 5.4
* 4.4: [Console] Fixes "Incorrectly nested style tag found" error when using multi-line header content Fix LDAP connection options [Security/Http] Ignore invalid URLs found in failure/success paths
2 parents 9593fef + 8d5ba95 commit 6694997

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Adapter/ExtLdap/Connection.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ class Connection extends AbstractConnection
2929
private const LDAP_INVALID_CREDENTIALS = 0x31;
3030
private const LDAP_TIMEOUT = 0x55;
3131
private const LDAP_ALREADY_EXISTS = 0x44;
32+
private const PRECONNECT_OPTIONS = [
33+
ConnectionOptions::DEBUG_LEVEL,
34+
ConnectionOptions::X_TLS_CACERTDIR,
35+
ConnectionOptions::X_TLS_CACERTFILE,
36+
ConnectionOptions::X_TLS_REQUIRE_CERT,
37+
];
3238

3339
/** @var bool */
3440
private $bound = false;
@@ -147,10 +153,18 @@ private function connect()
147153
return;
148154
}
149155

156+
foreach ($this->config['options'] as $name => $value) {
157+
if (\in_array(ConnectionOptions::getOption($name), self::PRECONNECT_OPTIONS, true)) {
158+
$this->setOption($name, $value);
159+
}
160+
}
161+
150162
$this->connection = ldap_connect($this->config['connection_string']);
151163

152164
foreach ($this->config['options'] as $name => $value) {
153-
$this->setOption($name, $value);
165+
if (!\in_array(ConnectionOptions::getOption($name), self::PRECONNECT_OPTIONS, true)) {
166+
$this->setOption($name, $value);
167+
}
154168
}
155169

156170
if (false === $this->connection) {

Adapter/ExtLdap/ConnectionOptions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ final class ConnectionOptions
4040
public const DEBUG_LEVEL = 0x5001;
4141
public const TIMEOUT = 0x5002;
4242
public const NETWORK_TIMEOUT = 0x5005;
43+
public const X_TLS_CACERTFILE = 0x6002;
4344
public const X_TLS_CACERTDIR = 0x6003;
4445
public const X_TLS_CERTFILE = 0x6004;
4546
public const X_TLS_CRL_ALL = 0x02;

0 commit comments

Comments
 (0)