BorisMorel / LdapBundle

This bundle is autonomous ; He doesn't require "apache mod_ldap"
103 stars 92 forks source link

Infinite recursion: bind -> connect -> bind -> connect -> .... #122

Closed Warbo closed 10 years ago

Warbo commented 10 years ago

Just updated to HEAD and got an infinite recursion:

[Fri Jul 4 11:00:33 2014] PHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Manager/LdapConnection.php on line 75 [Fri Jul 4 11:00:33 2014] PHP Stack trace: [Fri Jul 4 11:00:33 2014] PHP 1. {main}() /home/chris/codebase/webs-new-starter/web/index.php:0 [Fri Jul 4 11:00:33 2014] PHP 2. Silex\Application->run() /home/chris/codebase/webs-new-starter/web/index.php:62 [Fri Jul 4 11:00:33 2014] PHP 3. Silex\Application->handle() /home/chris/codebase/webs-new-starter/vendor/silex/silex/src/Silex/Application.php:515 [Fri Jul 4 11:00:33 2014] PHP 4. Symfony\Component\HttpKernel\HttpKernel->handle() /home/chris/codebase/webs-new-starter/vendor/silex/silex/src/Silex/Application.php:538 [Fri Jul 4 11:00:33 2014] PHP 5. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /home/chris/codebase/webs-new-starter/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:66 [Fri Jul 4 11:00:33 2014] PHP 6. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /home/chris/codebase/webs-new-starter/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:126 [Fri Jul 4 11:00:33 2014] PHP 7. Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() /home/chris/codebase/webs-new-starter/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:53 [Fri Jul 4 11:00:33 2014] PHP 8. call_user_func() /home/chris/codebase/webs-new-starter/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:164 [Fri Jul 4 11:00:33 2014] PHP 9. Symfony\Component\Security\Http\Firewall->onKernelRequest() /home/chris/codebase/webs-new-starter/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:164 [Fri Jul 4 11:00:33 2014] PHP 10. Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener->handle() /home/chris/codebase/webs-new-starter/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall.php:69 [Fri Jul 4 11:00:33 2014] PHP 11. Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager->authenticate() /home/chris/codebase/webs-new-starter/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php:74 [Fri Jul 4 11:00:33 2014] PHP 12. IMAG\LdapBundle\Provider\LdapAuthenticationProvider->authenticate() /home/chris/codebase/webs-new-starter/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/AuthenticationProviderManager.php:74 [Fri Jul 4 11:00:33 2014] PHP 13. IMAG\LdapBundle\Provider\LdapUserProvider->loadUserByUsername() /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Provider/LdapAuthenticationProvider.php:71 [Fri Jul 4 11:00:33 2014] PHP 14. IMAG\LdapBundle\Provider\LdapUserProvider->anonymousSearch() /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Provider/LdapUserProvider.php:64 [Fri Jul 4 11:00:33 2014] PHP 15. IMAG\LdapBundle\Manager\LdapManagerUser->exists() /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Provider/LdapUserProvider.php:104 [Fri Jul 4 11:00:33 2014] PHP 16. IMAG\LdapBundle\Manager\LdapManagerUser->addLdapUser() /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Manager/LdapManagerUser.php:32 [Fri Jul 4 11:00:33 2014] PHP 17. IMAG\LdapBundle\Manager\LdapConnection->search() /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Manager/LdapManagerUser.php:178 [Fri Jul 4 11:00:33 2014] PHP 18. IMAG\LdapBundle\Manager\LdapConnection->connect() /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Manager/LdapConnection.php:27 [Fri Jul 4 11:00:33 2014] PHP 19. IMAG\LdapBundle\Manager\LdapConnection->bind() /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Manager/LdapConnection.php:152 [Fri Jul 4 11:00:33 2014] PHP 20. IMAG\LdapBundle\Manager\LdapConnection->connect() /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Manager/LdapConnection.php:79 [Fri Jul 4 11:00:33 2014] PHP 21. IMAG\LdapBundle\Manager\LdapConnection->bind() /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Manager/LdapConnection.php:152 [Fri Jul 4 11:00:33 2014] PHP 22. IMAG\LdapBundle\Manager\LdapConnection->connect() /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Manager/LdapConnection.php:79 [Fri Jul 4 11:00:33 2014] PHP 23. IMAG\LdapBundle\Manager\LdapConnection->bind() /home/chris/codebase/webs-new-starter/vendor/imag/ldap-bundle/IMAG/LdapBundle/Manager/LdapConnection.php:152 (and so on)

BorisMorel commented 10 years ago

Hi, Yeah i think know the bug. You bind a special user for research on your Ldap ?

client:
    username:
    password:

True ?

Warbo commented 10 years ago

Yes, we bind as a special user, then authenticate by searching for the given HTTP auth details (via LdapManagerUser::addLdapUser, from what I can tell). Here's the config:

security: firewalls: restricted_area: pattern: ^/ ldap: true http: true imag_ldap: ~

providers: ldap: id: imag_ldap.security.user.provider

encoders: IMAG\LdapBundle\User\LdapUser: plaintext

access_control:

BorisMorel commented 10 years ago

Can you retry plz

Warbo commented 10 years ago

Great, it works! Now I can stop using my fork :)