xperseguers / t3ext-ig_ldap_sso_auth

TYPO3 Extension ig_ldap_sso_auth. This extension provides LDAP and SSO support for TYPO3.

Home Page:https://extensions.typo3.org/extension/ig_ldap_sso_auth

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can not import via Scheduler Task

lukasniestroj opened this issue · comments

the task results in "LDAP connection has already been closed"

LDAP connection has already been closed

in /srv/www/releases/13/private/typo3conf/ext/ig_ldap_sso_auth/Classes/Utility/LdapUtility.php line 336
                        false,  // Pagination is not critical for search to work anyway
                        $this->paginationCookie
                    );
            } else {
                $ldapControls = ldap_read($this->connection, '', '(objectClass=*)', ['supportedControl']);
                if (is_array($ldapControls) && in_array(LDAP_CONTROL_PAGEDRESULTS, ldap_get_entries($this->connection, $ldapControls)[0]['supportedcontrol'])) {
                    $this->hasPagination = true;
                }
                $controls = [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => static::MAX_ENTRIES, 'cookie' => $this->paginationCookie]]];
at ldap_read()
in /srv/www/releases/13/private/typo3conf/ext/ig_ldap_sso_auth/Classes/Utility/LdapUtility.php line 336
                        false,  // Pagination is not critical for search to work anyway
                        $this->paginationCookie
                    );
            } else {
                $ldapControls = ldap_read($this->connection, '', '(objectClass=*)', ['supportedControl']);
                if (is_array($ldapControls) && in_array(LDAP_CONTROL_PAGEDRESULTS, ldap_get_entries($this->connection, $ldapControls)[0]['supportedcontrol'])) {
                    $this->hasPagination = true;
                }
                $controls = [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => static::MAX_ENTRIES, 'cookie' => $this->paginationCookie]]];
at Causal\IgLdapSsoAuth\Utility\LdapUtility->search()
in /srv/www/releases/13/private/typo3conf/ext/ig_ldap_sso_auth/Classes/Library/Ldap.php line 194
        $result = [];
        $timeLimit = 0;
        $dereferenceAliases = LDAP_DEREF_NEVER;

        if ($this->ldapUtility->search($baseDn, $filter, $attributes, false, $firstEntry ? 1 : $limit, $timeLimit, $dereferenceAliases, $continueLastSearch)) {
            if ($firstEntry) {
                $result = $this->ldapUtility->getFirstEntry();
                $result['dn'] = $this->ldapUtility->getDn();
                unset($result['count']);
at Causal\IgLdapSsoAuth\Library\Ldap->search()
in /srv/www/releases/13/private/typo3conf/ext/ig_ldap_sso_auth/Classes/Library/LdapGroup.php line 105

        $filter = str_replace('{USERDN}', $ldapInstance->escapeDnForFilter($userDn), $filter);
        $filter = str_replace('{USERUID}', $ldapInstance->escapeDnForFilter($userUid), $filter);

        $groups = $ldapInstance->search($baseDn, $filter, $attributes);
        return $groups;
    }

    /**
at Causal\IgLdapSsoAuth\Library\LdapGroup::selectFromUser()
in /srv/www/releases/13/private/typo3conf/ext/ig_ldap_sso_auth/Classes/Library/Authentication.php line 493
            }
        } else {
            // Get LDAP groups from DN of user.
            $ldapGroups = LdapGroup::selectFromUser(
                static::$config['groups']['basedn'],
                static::$config['groups']['filter'],
                $ldapUser['dn'],
                !empty($ldapUser['uid'][0]) ? $ldapUser['uid'][0] : '',
                $ldapGroupAttributes,
at Causal\IgLdapSsoAuth\Library\Authentication::getLdapGroups()
in /srv/www/releases/13/private/typo3conf/ext/ig_ldap_sso_auth/Classes/Library/Authentication.php line 343

        // User is valid only if exist in TYPO3.
        // Get LDAP groups from LDAP user.
        $typo3_groups = [];
        $ldapGroups = static::getLdapGroups($ldapUser);
        unset($ldapGroups['count']);

        /** @var \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup[]|\TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup[] $requiredLDAPGroups */
        $requiredLDAPGroups = Configuration::getValue('requiredLDAPGroups');
at Causal\IgLdapSsoAuth\Library\Authentication::getUserGroups()
in /srv/www/releases/13/private/typo3conf/ext/ig_ldap_sso_auth/Classes/Utility/UserImportUtility.php line 215
            $extraData = $user['__extraData'];
            unset($user['__extraData']);
        }

        $typo3Groups = Authentication::getUserGroups($ldapUser, $this->configuration, $this->groupTable);
        if ($typo3Groups === null) {
            // Required LDAP groups are missing: quit!
            return $user;
        }
at Causal\IgLdapSsoAuth\Utility\UserImportUtility->import()
in /srv/www/releases/13/private/typo3conf/ext/ig_ldap_sso_auth/Classes/Task/ImportUsers.php line 193
                                    }
                                }
                            }

                            $importUtility->import($user, $aUser, $restoreBehaviour);
                        }

                        $this->getLogger()->info(sprintf(
                            'Configuration record %s: processed %s LDAP users (%s)', $configuration->getUid(), count($ldapUsers), $aContext
at Causal\IgLdapSsoAuth\Task\ImportUsers->execute()
in /srv/www/releases/13/private/typo3/sysext/scheduler/Classes/Scheduler.php line 185

My guess is that there are too many open/close calls. My lazy fix was to uncomment the disconnect function. But I don't know what sideeffects that might cause!