|
Date: 4/24/2006 1:52 am · Subject: Re: SQL Lookup for group membership fails · Rating: 7
After much debugging I've found the bit of code that doesn't seem to work correctly when looking up groups in an external DB.
In Grouping.pm there's a function isInGroup() - this has a section which looks up an external database if specified - this is where it actually gets tested. If the lookup is successful, and the result is 1 then it has a bit of code: $session{isInGroup}{$uid}{$gid} = 1 unless ($session{config}{disableCache}); This assignment does not seem to work - as later when it does a call: return 1 if ($session{isInGroup}{$uid}{$gid}); the value returned by $session{isInGroup}{$uid}{$gid} is blank. This causes it to fail the first time - though it has added the user to the group already, so next time it works.. until the group assignment expires and it happens again. I don't know why that assignment fails - I'm an amateur at perl (though I write code in C/C++ daily) - but I do know how to debug code and I littered the code with trace statements in order to figure this out. I've fixed it by using my own variable which I set to 1 if the lookup is successful (and it defaults to 0 if not) and I've changed that return statement to use my variable) I'll post this up on sourceforge as a bugfix - hopefully someone with better perl skills will understand why that assignment doesn't work - but in the meantime my hack fixes the issue we were experiencing here. Cheers, Jesse
--- (Edited on 4/24/2006 1:52 am [GMT-0500] by Jesse) ---
|