6.0.0-alpha12
6/9/25

[#3895] Auth::get... in hooks
Summary Auth::get... in hooks
Queue Horde Base
Queue Version HEAD
Type Bug
State Resolved
Priority 1. Low
Owners jan (at) horde (dot) org
Requester adrieder (at) sbox (dot) tugraz (dot) at
Created 05/07/2006 (6973 days ago)
Due
Updated 08/04/2006 (6884 days ago)
Assigned 05/11/2006 (6969 days ago)
Resolved 08/04/2006 (6884 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
08/04/2006 10:03:01 PM Jan Schneider Comment #27
State ⇒ Resolved
Reply to this comment
Auth::getAuth() is working fine for me in the current code, of course 
only in the hook run *after* the authentication.

The preferences are reloaded right before the authentication for 
technical reasons, during this run Auth::getAuth() is empty of course.
07/18/2006 10:51:25 PM stian_web (at) jordet (dot) nu Comment #26 Reply to this comment
Hi,

I am having also issues on calling Auth::getBareAuth() or
Auth::getAuth() on hooks.php. Auth::getBareAuth() worked on Horde
3.1.1, but it's broken on Horde 3.1.2.
Just a me too. Without Auth::getAuth working, we need desperately an 
alternative...
07/14/2006 06:29:33 AM kimmo (dot) liikonen (at) phnet (dot) fi Comment #25 Reply to this comment
Hi,



I am having also issues on calling Auth::getBareAuth() or 
Auth::getAuth() on hooks.php. Auth::getBareAuth() worked on Horde 
3.1.1, but it's broken on Horde 3.1.2.



Reason why i need that, is that i want search from_addr from ldap 
server (with _prefs_hook_from_addr fuction). And i need username for 
search. Is there any other way to get username of current session?



I think this is major problem in bigger installations of Horde/IMP.


06/29/2006 09:41:59 AM adrieder (at) sbox (dot) tugraz (dot) at Comment #24 Reply to this comment
Prefs caching was broken for a while. Can you try if your hooks get
called only on login now?
Now, they get called only once on login. But still 3 times on logout.
06/29/2006 08:36:51 AM Jan Schneider Comment #23 Reply to this comment
Prefs caching was broken for a while. Can you try if your hooks get 
called only on login now?
05/11/2006 05:12:33 PM Jan Schneider Comment #22 Reply to this comment
I have no idea where these double calls are coming from. I can 
reproduce them, and the weird thing is that the backtraces to both 
calls are absolutely identical and at the same time.
05/11/2006 05:09:26 PM Jan Schneider Deleted Original Message
 
05/11/2006 05:09:14 PM Jan Schneider Deleted Original Message
 
05/11/2006 04:55:04 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #21 Reply to this comment
Maybe I didn't get everything, but is there a reason why the hook
gets called 4 times at login?
No, 2 times should be sufficient, we should look into this.
Ok! Thanks for explaining.



So a short summary:

1. If a user logs in the first time on the system the hook 
"_prefs_hook_from_addr" gets called 4 times.

2. On all subsequent logins, the hook gest called 2 times.

3. On every logout the hook gets called 4 times.



p.s: please remove my "stupid" :-) patches
05/11/2006 04:41:53 PM Jan Schneider Comment #20
Priority ⇒ 1. Low
Reply to this comment
As I discovered and tried to explain below, the hook is called before
the Auth object is filled. And there I get false from the various
Auth::get... calls.
That's how it is supposed to work. If entering the script you're not 
authenticated, thus Auth::getAuth() returns false. After 
authentication the prefs are reloaded for the authenticated user.
Maybe I didn't get everything, but is there a reason why the hook
gets called 4 times at login?
No, 2 times should be sufficient, we should look into this.
05/11/2006 04:36:52 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #19 Reply to this comment
I'm pretty sure that my configs are up to date.



As I discovered and tried to explain below, the hook is called before 
the Auth object is filled. And there I get false from the various 
Auth::get... calls.

But the hook gets recalled later on in the login process and then the 
Auth::get... calls also return the desired values.

Now that I know this, I modified the hook in the way that it just 
returns if Auth::get... returns false. Before I wasn't checking that 
and used the any returned value for doing an ldap lookup. That was 
confusing me, because of errors in the subsequent ldap lookups.



Maybe I didn't get everything, but is there a reason why the hook gets 
called 4 times at login?
05/11/2006 03:20:31 PM Jan Schneider Comment #18
State ⇒ Feedback
Reply to this comment
Looking at your patches that you claim have fixed your problem, it 
looks like you didn't update your configuration.
05/11/2006 02:14:06 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #17 Reply to this comment
If the from_addr pref is then set in the prefs, the hook gets called
2 times, where again Auth::get... returns just false.
I mean if it is set and the user log out and in again, it is called 
twice during login.
05/11/2006 02:12:04 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #16 Reply to this comment
OK, on login the hook (_prefs_hook_from_addr) gets called 4 times, the 
first two times Auth::get... doesn't work, and then it works.

If the from_addr pref is then set in the prefs, the hook gets called 2 
times, where again Auth::get... returns just false.
05/11/2006 01:35:18 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #15 Reply to this comment
If I read the code right, they are called when the registry function 
loadPrefs() is used. It gets the preferences via $prefs->retrieve(). 
This retrieve() function uses the private method _callHooks() from the 
Prefs class.



Now there is one place in imp/login.php where loadPrefs() is called 
when the Auth object is cleared. This is when a user logs out (see 
imp/login line 92 and 93). I don't know the exact reason why it is 
called, but anyway at this point the Auth::get...() methods in th hook 
doesn't work.



It is also called via Auth::clearAuth() in which again the auth info 
from the Auth object is already removed before the loadPrefs call. 
Auth::clearAuth() is also called in imp/login.php when a user logs 
out. Therefore the hooks are called twice on a logout and I get also 
the errors twice.



I didn't figure out what happens when  a user logs in (authentication 
is done by IMP), but there it also seams to be the case that the hooks 
are called to early or are not recalled again.




05/11/2006 03:40:40 AM Chuck Hagenbuch Comment #14
Assigned to Jan Schneider
State ⇒ Assigned
Reply to this comment
That doesn't look right, but it does point towards the problem - looks 
like hooks are being called before the user is authenticated, and then 
not re-called, or the session cache not being cleared, once 
authentication takes place.
05/10/2006 11:02:01 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #13
New Attachment: Registry.php.patch
Reply to this comment
And here the second one...
05/10/2006 11:01:03 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #12
New Attachment: Prefs.php.patch
Reply to this comment
The attched patches fix the problem. Any comments? Are they ok?
05/10/2006 08:47:27 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #11 Reply to this comment
05/10/2006 08:40:52 PM Jan Schneider Comment #10 Reply to this comment
And did my fix for Prefs.php make any difference?
05/10/2006 08:27:41 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #9 Reply to this comment
Ok, found also the changes that cause my problem, see:

<http://marc.theaimsgroup.com/?l=horde-cvs&m=114678117806849&w=2>



If I copy back the old versions of 
"framework/Horde/Horde/Registry.php" and "framework/Prefs/Prefs.php" 
the problem is gone.


05/10/2006 09:38:21 AM adrieder (at) sbox (dot) tugraz (dot) at Comment #8 Reply to this comment
Ok I found out the date now.

I used my May 2nd running version and did a incremental cvs update as follows:

cvs update -Pd  -D 20060503

           -> Auth::get... ok

cvs update -Pd  -D 20060504

           -> Auth::get... ok

cvs update -Pd  -D 20060505

           -> Auth::get... ok

cvs update -Pd  -D 20060506

           -> Auth::get...  _not ok_



maybe this helps
05/10/2006 03:37:41 AM Chuck Hagenbuch Comment #7 Reply to this comment
I'm not seeing it, but I don't have a lot of hooks in my local 
install. It's not sexy, but if you could narrow the problem down to a 
specific date, and to changes in either IMP, Horde, or the framework, 
that'd be extremely helpful.
05/09/2006 11:43:55 AM adrieder (at) sbox (dot) tugraz (dot) at Comment #6 Reply to this comment
Any hint where I could start searching or debugging?

Is this reproduceable by someone else?
05/08/2006 10:33:14 AM adrieder (at) sbox (dot) tugraz (dot) at Comment #5 Reply to this comment
This was committed on April 19th, but the May 2nd version is still working.

I also tested it by installing the base.php version before this 
commit. Still the same problem.
05/08/2006 09:54:19 AM Jan Schneider Comment #4 Reply to this comment
05/08/2006 06:09:46 AM adrieder (at) sbox (dot) tugraz (dot) at Comment #3 Reply to this comment
Yes, I'm running HEAD of all modules in use.

I don't know the exact date when it stopped working, but I know that 
the version of May 2nd does not show this behaviour
05/08/2006 12:52:25 AM Chuck Hagenbuch Comment #2
State ⇒ Feedback
Reply to this comment
Can you confirm you're using HEAD of everything here? If so, was there 
an update on a specific date where it stopped working?
05/07/2006 09:08:42 AM adrieder (at) sbox (dot) tugraz (dot) at Comment #1
Priority ⇒ 3. High
State ⇒ Unconfirmed
Queue ⇒ Horde Base
Type ⇒ Bug
Summary ⇒ Auth::get... in hooks
Reply to this comment
When calling one of the following functions:



Auth::getBareAuth();

Auth::getCredential('password');

Auth::getAuthDomain();



within the hook _prefs_hook_from_addr or _prefs_hook_fullname, these 
calls return just "false".



I'm using IMP for handling authentications

Saved Queries