Skip to content
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

Check value of port when it is being set, and use getPort() throughout. #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
11 changes: 7 additions & 4 deletions lib/adLDAP/adLDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ public function getDomainControllers() {
*
* @param int $adPort
*/
public function setPort($adPort) {
public function setPort($adPort) {
if (!is_numeric($adPort)) {
throw new adLDAPException("[ad_port] must be a number; '$adPort' given");
}
$this->adPort = $adPort;
}

Expand Down Expand Up @@ -621,9 +624,9 @@ public function connect() {
// Connect to the AD/LDAP server as the username/password
$domainController = $this->randomController();
if ($this->useSSL) {
$this->ldapConnection = ldap_connect("ldaps://" . $domainController, $this->adPort);
$this->ldapConnection = ldap_connect("ldaps://" . $domainController, $this->getPort());
} else {
$this->ldapConnection = ldap_connect("ldap://" . $domainController, $this->adPort);
$this->ldapConnection = ldap_connect("ldap://" . $domainController, $this->getPort());
}

// Set some ldap options for talking to AD
Expand Down Expand Up @@ -971,7 +974,7 @@ protected function randomController() {
* @return bool
*/
protected function pingController($host) {
$port = $this->adPort;
$port = $this->getPort();
fsockopen($host, $port, $errno, $errstr, 10);
if ($errno > 0) {
return false;
Expand Down