Fix some more ldap issues

Summary:
  - LDAP import needs to use envelopes.
  - Use ldap_sprintf().

Test Plan: Configured an LDAP server. Added an account. Imported it; logged in with it. Tried to login with accounts like ",", etc., got good errors.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D2995
This commit is contained in:
epriestley
2012-07-17 14:05:26 -07:00
parent a620a172a0
commit 30deacdbaf
3 changed files with 48 additions and 37 deletions

View File

@@ -35,10 +35,12 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
$current_user = $this->getRequest()->getUser();
$request = $this->getRequest();
$ldap_username = $request->getCookie('phusr');
if ($request->isFormPost()) {
$ldap_username = $request->getStr('username');
try {
$envelope = new PhutilOpaqueEnvelope($request->getStr('password'));
$this->provider->auth($request->getStr('username'), $envelope);
$this->provider->auth($ldap_username, $envelope);
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
@@ -124,7 +126,6 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
}
}
$ldap_username = $request->getCookie('phusr');
$ldap_form = new AphrontFormView();
$ldap_form
->setUser($request->getUser())