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

Avoid double ldap_unbind in Wizard.php #34523

Merged
merged 2 commits into from
Oct 11, 2022
Merged
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
37 changes: 18 additions & 19 deletions apps/user_ldap/lib/Wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ private function getUserAttributes() {
*/
public function determineGroupsForGroups() {
return $this->determineGroups('ldap_groupfilter_groups',
'ldapGroupFilterGroups',
false);
'ldapGroupFilterGroups',
false);
}

/**
Expand All @@ -385,7 +385,7 @@ public function determineGroupsForGroups() {
*/
public function determineGroupsForUsers() {
return $this->determineGroups('ldap_userfilter_groups',
'ldapUserFilterGroups');
'ldapUserFilterGroups');
}

/**
Expand Down Expand Up @@ -512,10 +512,10 @@ public function determineGroupObjectClasses() {

$obclasses = ['groupOfNames', 'groupOfUniqueNames', 'group', 'posixGroup', '*'];
$this->determineFeature($obclasses,
'objectclass',
'ldap_groupfilter_objectclass',
'ldapGroupFilterObjectclass',
false);
'objectclass',
'ldap_groupfilter_objectclass',
'ldapGroupFilterObjectclass',
false);

return $this->result;
}
Expand Down Expand Up @@ -543,10 +543,10 @@ public function determineUserObjectClasses() {
//if filter is empty, it is probably the first time the wizard is called
//then, apply suggestions.
$this->determineFeature($obclasses,
'objectclass',
'ldap_userfilter_objectclass',
'ldapUserFilterObjectclass',
empty($filter));
'objectclass',
'ldap_userfilter_objectclass',
'ldapUserFilterObjectclass',
empty($filter));

return $this->result;
}
Expand All @@ -567,7 +567,7 @@ public function getGroupFilter() {
if ($displayName === '') {
$d = $this->configuration->getDefaults();
$this->applyFind('ldap_group_display_name',
$d['ldap_group_display_name']);
$d['ldap_group_display_name']);
}
$filter = $this->composeLdapFilter(self::LFILTER_GROUP_LIST);

Expand Down Expand Up @@ -1093,7 +1093,6 @@ private function connectAndBind($port, $tls) {
}

if ($login === true) {
$this->ldap->unbind($cr);
$this->logger->debug(
'Wiz: Bind successful to Port '. $port . ' TLS ' . (int)$tls,
['app' => 'user_ldap']
Expand Down Expand Up @@ -1198,8 +1197,8 @@ public function cumulativeSearchOnAttribute($filters, $attr, $dnReadLimit = 3, &
}
$newItems = [];
$state = $this->getAttributeValuesFromEntry($attributes,
$attr,
$newItems);
$attr,
$newItems);
$dnReadCount++;
$foundItems = array_merge($foundItems, $newItems);
$this->resultCache[$dn][$attr] = $newItems;
Expand Down Expand Up @@ -1242,7 +1241,7 @@ private function determineFeature($objectclasses, $attr, $dbkey, $confkey, $po =

$availableFeatures =
$this->cumulativeSearchOnAttribute($objectclasses, $attr,
$dig, $maxEntryObjC);
$dig, $maxEntryObjC);
if (is_array($availableFeatures)
&& count($availableFeatures) > 0) {
natcasesort($availableFeatures);
Expand Down Expand Up @@ -1321,8 +1320,8 @@ private function getConnection() {
}

$lo = @$this->ldap->bind($cr,
$this->configuration->ldapAgentName,
$this->configuration->ldapAgentPassword);
$this->configuration->ldapAgentName,
$this->configuration->ldapAgentPassword);
if ($lo === true) {
$this->cr = $cr;
return $cr;
Expand Down Expand Up @@ -1370,7 +1369,7 @@ private function getPortSettingsToTry() {

//default ports
$portSettings = array_merge($portSettings,
$this->getDefaultLdapPortSettings());
$this->getDefaultLdapPortSettings());

return $portSettings;
}
Expand Down