Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e9e2ac9

Browse filesBrowse files
committed
Fix LDAP connection options
1 parent 129a271 commit e9e2ac9
Copy full SHA for e9e2ac9

File tree

2 files changed

+22
-1
lines changed
Filter options

2 files changed

+22
-1
lines changed

‎src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,18 @@ private function connect()
147147
return;
148148
}
149149

150+
foreach ($this->config['options'] as $name => $value) {
151+
if (ConnectionOptions::isPreconnectOption($name)) {
152+
$this->setOption($name, $value);
153+
}
154+
}
155+
150156
$this->connection = ldap_connect($this->config['connection_string']);
151157

152158
foreach ($this->config['options'] as $name => $value) {
153-
$this->setOption($name, $value);
159+
if (!ConnectionOptions::isPreconnectOption($name)) {
160+
$this->setOption($name, $value);
161+
}
154162
}
155163

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

‎src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php
+13Lines changed: 13 additions & 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;
@@ -62,6 +63,13 @@ final class ConnectionOptions
6263
public const X_KEEPALIVE_PROBES = 0x6301;
6364
public const X_KEEPALIVE_INTERVAL = 0x6302;
6465

66+
private const PRECONNECT_OPTIONS = [
67+
self::DEBUG_LEVEL,
68+
self::X_TLS_CACERTDIR,
69+
self::X_TLS_CACERTFILE,
70+
self::X_TLS_REQUIRE_CERT,
71+
];
72+
6573
public static function getOptionName(string $name): string
6674
{
6775
return sprintf('%s::%s', self::class, strtoupper($name));
@@ -89,4 +97,9 @@ public static function isOption(string $name): bool
8997
{
9098
return \defined(self::getOptionName($name));
9199
}
100+
101+
public static function isPreconnectOption(string $name): bool
102+
{
103+
return \in_array(self::getOption($name), self::PRECONNECT_OPTIONS, true);
104+
}
92105
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.