I've noticed what may be a bug. In "Recent Log messages" you can see 2 instances of "Session opened for ..." for each user that logs in. When I have the ldap_authorization_drupal_role module enabled, I can see the watchdog output messages (it's set at DEBUG) for ldap_authorization proceed in sequence again after the 2nd "Session opened for" message (the 2nd usage of user_login_submit() function).
The 2nd time that the messages show, the ldap_authorization consumer behavior begins anew. I've tracked this through more watchdog messages. Unfortunately, this can result in PHP errors with some code that I'm writing. It's entirely possible that these errors are my doing, but the fact remains that user_login_submit() is called twice.
I don't mean to sound upset, I love the way this module is being developed and it's already been pretty useful to me. I just wanted to point this out in the hopes that it can be confirmed so I don't feel crazy anymore!
Comments
Comment #1
johnbarclay commentedThanks. This is exactly what this module needs. More people looking at the innards of the code. All the simpletests and installation won't find such errors. Here are my initial thoughts:
user_login_submit() is likely only called once by ldap_authentication, at the end of the long _ldap_authentication_user_login_authenticate_validate() function.
?? do you think its being called by ldap_authentication and ldap_authorization 2x??
In the same file, I've had to work around a bug in core (http://drupal.org/node/1022362) where the user_login_authenticate_validate() function will ignore successful authentications by other modules, despite $form_state['uid'] being set. Until the bug is fixed (and its getting no love), I moved the user_login_authenticate_validate() function to the beginning of the sequence so that it doesn't submit the user_login_submit() a second time.
?? Is it possible your code is altering this order or successfully authenticating the user, but not setting $form_state['uid']??
I'll look more closely at this also and see if I can recreate the double call.
I
Comment #2
dayer4b commentedI threw a debug_backtrace() into watchdog in user.module to see what functions were calling user_login_submit() each time. This is without my module enabled, only ldap_authorization_drupal_role is being used as a Consumer.
first time:
second time:
EDIT:
I put the debug_backtrace() into the user_login_finalize() function just prior to the "Session opened for ..." watchdog message. I don't see any mention of the LDAP modules in the second backtrace, but I know that with the LDAP module disabled entirely, this doesn't happen.
EDIT:
I simplified the file paths so it's easier to read the backtrace.
Comment #3
johnbarclay commentedSo the second time is the bug.
perhaps I need to clear the $form['#submit'] array when I do the fake submit around here:
I don't see a good way to resolve this until the bug in core is fixed (http://drupal.org/node/1009990)
Comment #4
johnbarclay commentedComment #5
johnbarclay commentedComment #6
johnbarclay commented