Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13814084
D7679.id17337.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D7679.id17337.diff
View Options
Index: src/auth/PhutilAuthAdapterLDAP.php
===================================================================
--- src/auth/PhutilAuthAdapterLDAP.php
+++ src/auth/PhutilAuthAdapterLDAP.php
@@ -218,7 +218,18 @@
$this->bindLDAP($conn, $distinguished_name, $login_pass);
- return $this->searchLDAPForUser($this->searchAttribute, $login_user);
+ $result = $this->searchLDAPForUser($this->searchAttribute, $login_user);
+ if (!$result) {
+ // This is unusual (since the bind succeeded) but we've seen it at least
+ // once in the wild. Raise an explicit exception since we'll fail a
+ // typehint if we don't return an array here.
+ throw new Exception(
+ pht(
+ 'LDAP: Failed to retrieve record for user "%s" when searching.',
+ $login_user));
+ }
+
+ return $result;
}
private function establishConnection() {
@@ -360,7 +371,7 @@
return $results;
}
- private function raiseConnectionException($conn, $message, $is_bind = false) {
+ private function raiseConnectionException($conn, $message) {
$errno = @ldap_errno($conn);
$error = @ldap_error($conn);
@@ -397,8 +408,7 @@
if (!$ok) {
$this->raiseConnectionException(
$conn,
- pht("Failed to bind to LDAP server (as user '%s').", $user),
- $is_bind = true);
+ pht("Failed to bind to LDAP server (as user '%s').", $user));
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Sep 20, 3:15 AM (4 h, 34 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6622382
Default Alt Text
D7679.id17337.diff (1 KB)
Attached To
Mode
D7679: Raise an exception if LDAP search fails
Attached
Detach File
Event Timeline
Log In to Comment