Skip to content

Commit bf1c4c2

Browse files
committed
Ensure compatibility with SSP 1.x and 2.x by inlining arrayize
1 parent d47aa64 commit bf1c4c2

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

lib/Auth/Ldap.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public function searchfordn(
351351
string $scope = 'subtree'
352352
): ?string {
353353
// Traverse all search bases, returning DN if found
354-
$bases = Utils\Arrays::arrayize($base);
354+
$bases = is_array($base) ? $base : [$base];
355355
foreach ($bases as $current) {
356356
try {
357357
// Single base search
@@ -373,8 +373,9 @@ public function searchfordn(
373373
return null;
374374
} else {
375375
// Zero hits not allowed
376+
$attributes = is_array($attribute) ? $attribute : [$attribute];
376377
throw $this->makeException('Library - LDAP searchfordn(): LDAP search returned zero entries for' .
377-
' filter \'(' . join(' | ', Utils\Arrays::arrayize($attribute)) .
378+
' filter \'(' . join(' | ', $attributes) .
378379
' = ' . $value . ')\' on base(s) \'(' . join(' & ', $bases) . ')\'', 2);
379380
}
380381
}
@@ -435,7 +436,7 @@ public function searchformultiple(
435436
throw $this->makeException('ldap:LdapConnection->search_manual : No base DNs were passed', ERR_INTERNAL);
436437
}
437438

438-
$attributes = Utils\Arrays::arrayize($attributes);
439+
$attributes = is_array($attributes) ? $attributes : [$attributes];
439440

440441
// Search each base until result is found
441442
$result = false;
@@ -755,7 +756,7 @@ public function validate(array $config, string $username, string $password = nul
755756
public static function escapeFilterValue($values = [], bool $singleValue = true)
756757
{
757758
// Parameter validation
758-
$values = Utils\Arrays::arrayize($values);
759+
$values = is_array($values) ? $values : [$values];
759760

760761
foreach ($values as $key => $val) {
761762
if ($val === null) {

lib/Auth/Process/AttributeAddUsersGroups.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ protected function searchActiveDirectory(string $dn): array
349349
' Member Attribute: ' . $map['member'] .
350350
' Type Attribute: ' . $map['type'] .
351351
' Type Value: ' . $this->type_map['group'] .
352-
' Base: ' . implode('; ', Arrays::Arrayize($this->base_dn))
352+
' Base: ' . implode('; ', is_array($this->base_dn) ? $this->base_dn : [$this->base_dn]);
353353
);
354354

355355
// AD connections should have this set

0 commit comments

Comments
 (0)