Skip to content

Commit 8d05e18

Browse files
authored
Merge pull request #34523 from nextcloud/fix/ldap-avoid-double-unbind-in-wizard
Avoid double ldap_unbind in Wizard.php
2 parents 94ded14 + 1d2d6e8 commit 8d05e18

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

apps/user_ldap/lib/Wizard.php

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,8 @@ private function getUserAttributes() {
375375
*/
376376
public function determineGroupsForGroups() {
377377
return $this->determineGroups('ldap_groupfilter_groups',
378-
'ldapGroupFilterGroups',
379-
false);
378+
'ldapGroupFilterGroups',
379+
false);
380380
}
381381

382382
/**
@@ -385,7 +385,7 @@ public function determineGroupsForGroups() {
385385
*/
386386
public function determineGroupsForUsers() {
387387
return $this->determineGroups('ldap_userfilter_groups',
388-
'ldapUserFilterGroups');
388+
'ldapUserFilterGroups');
389389
}
390390

391391
/**
@@ -512,10 +512,10 @@ public function determineGroupObjectClasses() {
512512

513513
$obclasses = ['groupOfNames', 'groupOfUniqueNames', 'group', 'posixGroup', '*'];
514514
$this->determineFeature($obclasses,
515-
'objectclass',
516-
'ldap_groupfilter_objectclass',
517-
'ldapGroupFilterObjectclass',
518-
false);
515+
'objectclass',
516+
'ldap_groupfilter_objectclass',
517+
'ldapGroupFilterObjectclass',
518+
false);
519519

520520
return $this->result;
521521
}
@@ -543,10 +543,10 @@ public function determineUserObjectClasses() {
543543
//if filter is empty, it is probably the first time the wizard is called
544544
//then, apply suggestions.
545545
$this->determineFeature($obclasses,
546-
'objectclass',
547-
'ldap_userfilter_objectclass',
548-
'ldapUserFilterObjectclass',
549-
empty($filter));
546+
'objectclass',
547+
'ldap_userfilter_objectclass',
548+
'ldapUserFilterObjectclass',
549+
empty($filter));
550550

551551
return $this->result;
552552
}
@@ -567,7 +567,7 @@ public function getGroupFilter() {
567567
if ($displayName === '') {
568568
$d = $this->configuration->getDefaults();
569569
$this->applyFind('ldap_group_display_name',
570-
$d['ldap_group_display_name']);
570+
$d['ldap_group_display_name']);
571571
}
572572
$filter = $this->composeLdapFilter(self::LFILTER_GROUP_LIST);
573573

@@ -1093,7 +1093,6 @@ private function connectAndBind($port, $tls) {
10931093
}
10941094

10951095
if ($login === true) {
1096-
$this->ldap->unbind($cr);
10971096
$this->logger->debug(
10981097
'Wiz: Bind successful to Port '. $port . ' TLS ' . (int)$tls,
10991098
['app' => 'user_ldap']
@@ -1198,8 +1197,8 @@ public function cumulativeSearchOnAttribute($filters, $attr, $dnReadLimit = 3, &
11981197
}
11991198
$newItems = [];
12001199
$state = $this->getAttributeValuesFromEntry($attributes,
1201-
$attr,
1202-
$newItems);
1200+
$attr,
1201+
$newItems);
12031202
$dnReadCount++;
12041203
$foundItems = array_merge($foundItems, $newItems);
12051204
$this->resultCache[$dn][$attr] = $newItems;
@@ -1242,7 +1241,7 @@ private function determineFeature($objectclasses, $attr, $dbkey, $confkey, $po =
12421241

12431242
$availableFeatures =
12441243
$this->cumulativeSearchOnAttribute($objectclasses, $attr,
1245-
$dig, $maxEntryObjC);
1244+
$dig, $maxEntryObjC);
12461245
if (is_array($availableFeatures)
12471246
&& count($availableFeatures) > 0) {
12481247
natcasesort($availableFeatures);
@@ -1321,8 +1320,8 @@ private function getConnection() {
13211320
}
13221321

13231322
$lo = @$this->ldap->bind($cr,
1324-
$this->configuration->ldapAgentName,
1325-
$this->configuration->ldapAgentPassword);
1323+
$this->configuration->ldapAgentName,
1324+
$this->configuration->ldapAgentPassword);
13261325
if ($lo === true) {
13271326
$this->cr = $cr;
13281327
return $cr;
@@ -1370,7 +1369,7 @@ private function getPortSettingsToTry() {
13701369

13711370
//default ports
13721371
$portSettings = array_merge($portSettings,
1373-
$this->getDefaultLdapPortSettings());
1372+
$this->getDefaultLdapPortSettings());
13741373

13751374
return $portSettings;
13761375
}

0 commit comments

Comments
 (0)