]> BookStack Code Mirror - bookstack/commitdiff
Set ldap to not follow referrals by default
authorDan Brown <redacted>
Mon, 10 Jul 2017 18:43:49 +0000 (19:43 +0100)
committerDan Brown <redacted>
Mon, 10 Jul 2017 18:43:49 +0000 (19:43 +0100)
Added LDAP_FOLLOW_REFERRALS .env option to override.
Fixes #317

app/Services/LdapService.php
config/services.php

index 71dc9c0e1a57b731048445bcdd78fed57e98c6a2..598efc19dd68828fab45da38304509056f215189 100644 (file)
@@ -42,6 +42,8 @@ class LdapService
         $userFilter = $this->buildFilter($this->config['user_filter'], ['user' => $userName]);
         $baseDn = $this->config['base_dn'];
         $emailAttr = $this->config['email_attribute'];
+        $followReferrals = $this->config['follow_referrals'] ? 1 : 0;
+        $this->ldap->setOption($ldapConnection, LDAP_OPT_REFERRALS, $followReferrals);
         $users = $this->ldap->searchAndGetEntries($ldapConnection, $baseDn, $userFilter, ['cn', 'uid', 'dn', $emailAttr]);
         if ($users['count'] === 0) return null;
 
index 99022e5f2bed0b0b7a415a9d6929ef9f1c45bf3a..b4959c7249cbbffb0024bc448e8ec00bb452172a 100644 (file)
@@ -80,6 +80,7 @@ return [
         'user_filter' => env('LDAP_USER_FILTER', '(&(uid=${user}))'),
         'version' => env('LDAP_VERSION', false),
         'email_attribute' => env('LDAP_EMAIL_ATTRIBUTE', 'mail'),
+        'follow_referrals' => env('LDAP_FOLLOW_REFERRALS', false),
     ]
 
 ];
Morty Proxy This is a proxified and sanitized view of the page, visit original site.