8000 [ldap][2.8] Optional search for primary DN before bind by markussc · Pull Request #17813 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[ldap][2.8] Optional search for primary DN before bind #17813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[ldap][2.8] Optional search for DN before bind
May be used e.g. if DN does not contain username.
  • Loading branch information
markussc committed Feb 15, 2016
commit 9a145e1bdee1570f8cd2c10a92dc345a0cd22a7e
13 changes: 12 additions & 1 deletion src/Symfony/Component/Ldap/LdapClient.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class LdapClient implements LdapClientInterface
private $useStartTls;
private $optReferrals;
private $connection;
private $charmaps;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this field. It is not used.


/**
* Constructor.
Expand Down Expand Up @@ -68,7 +69,17 @@ public function bind($dn = null, $password = null)
if (!$this->connection) {
$this->connect();
}


$dnArr = explode(";",$dn);
if(count($dnArr) > 1)
{
$searchResult = $this->find($dnArr[1], $dnArr[0], '*');

if(count($searchResult))
{
$dn = $searchResult[0]['dn'];
}
}
if (false === @ldap_bind($this->connection, $dn, $password)) {
throw new ConnectionException(ldap_error($this->connection));
}
Expand Down
0