Closed (fixed)
Project:
Bakery Single Sign-On System
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
23 Mar 2010 at 22:11 UTC
Updated:
13 May 2010 at 23:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
catorghans commentedYes, I really would be interested in this and also be able to help. If bakery for drupal 7 would be able to handle drupal 6 slaves (or vice versa) that would help us greatly in a careful upgrade of our sites.
Comment #2
juliangb commentedThis is my work so far. Warning - this code currently does not work.
It seems mainly to be DBTNG changes that are required.
I will post another patch once i've done a bit more.
Comment #3
coltraneUpdated patch from the one in #2 by juliangb.
Applying patch to D7 CVS HEAD site and 6.x of Bakery on a Atrium site and I'm getting SSO to work. Need to test synchronizing fields next,
email works though. Update: no syncing works yet.One issue: the list of slaves isn't populated after saving, but it's set in the variable. Not sure why it's not filling in the text area correctly.
Comment #4
coltraneWorking sync! only tested with email so far though
Edit: After spending so much time in bakery_user_presave() I realize the $_SESSION storage there isn't necessary ... Will update soon
Comment #5
juliangb commentedExcellent - sounds like you've got a lot further than I got.
Have you tested with the D7 version being the master and the slave (not necessarily at the same time)?
I will test this more fully later on today hopefully.
It would be really great if one of the maintainers could branch the D6 version off in CVS and commit this to HEAD for a 7.x-1.x-dev. That will really help testing from now.
Comment #6
juliangb commentedTested with the D7 site being the bakery slave,
Got 500 Internal Server Error at page
/bakery?destination=node, having clicked 'login'.Comment #7
juliangb commentedThe attached patch gets rid of the 500 error, successfully redirects to the master (running on D6), which redirects back. Here we hit:
Fatal error: Call to undefined function db_result() in /sites/all/modules/bakery-HEAD/bakery.module on line 486Comment #8
juliangb commentedThis patch now works for me - I have been testing using a D6 master, and D7 slave.
Comment #9
gregglesI've created 6.x branch and 6.x-1.0-alpha1 release. That lets HEAD become the D7 compatible version.
http://drupal.org/node/528018 is the 7.0 release, though it needs 12 more hours to get re-generated to get a real tarball.
Comment #10
coltraneThanks juliangb!
Updated patch:
* There was a leftover watchdog() for debugging, removed.
* Have to store updated fields in the session because we need to implement hook_user_presave() and hook_user_update() so updated fields are pushed on update, but not insert (like user register).
* Translated menu item was using old drupal_get_destination() style
* Form alter on user forms wasn't accessing user object correctly
* Updated bakery_uncrumble_validate() user search -- but, not sure if user_load_multiple() hashes 'pass' in the condition array. Haven't tested bakery repair.
Of considerable note:
In bakery_user_authenticate_finalize() I'm calling drupal_session_regenerate(). The D6 code has a similar line commented out but in my testing of a slave d7 site running drupal_session_regenerate() the user gets logged in correctly, and stays logged in to the master site. So it seems like it should be in to protect against unlikely session fixation attacks. juliangb, let me know if anything odd happens with your tests.
I think this could be set to RTBC pending some more tests. The remaining issues could be discussed and handled in followups.
Comment #11
coltraneI think it's good for dev branch.
Comment #12
juliangb commentedI haven't had a chance to do further tests (at somepoint soon I hope), but I'd agree that this is ready to put into the -dev branch, and we can sort any further bugs out there.
Not sure about the session regeneration issue - but I guess it is better to be safe than sorry. It is odd that it is in the D6 version but commented out.
Comment #13
gregglesCool - committed - http://drupal.org/cvs?commit=355086
Thanks coltrane and juliangb!
Back to needs work and an updated title to better reflect the status. I'll update the project page to point to this.
Comment #14
juliangb commentedD7 slave site - user account page:
- Doesn't show link to profile on master site
- Allows changing of password / email address on slave site
Comment #15
juliangb commentedAlso, D7 slave site, when the user logs out - the site gets quite messed up. The entire page is rendered again within the content region.
Error in logs:
Recoverable fatal error: Argument 1 passed to drupal_http_build_query() must be an array, string given, called in /home/drupalde/public_html/d7-core/includes/common.inc on line 2049 and defined in drupal_http_build_query() (line 466 of /home/drupalde/public_html/d7-core/includes/common.inc).Although the error doesn't mention bakery, it goes away when bakery is disabled.
Comment #16
juliangb commentedWould it be possible to check the recommended box for the D7 version please? Currently we can't do a drush dl bakery for d7.
EDIT - you can use drush dl bakery-7.x-1.x still, so this isn't critical - it'd just make testing thing out a little quicker!
Comment #17
juliangb commentedWhen saving the admin settings form, all listed slave sites disappear.
Comment #18
coltraneThis patch fixes the bakery slaves not being displayed after submitting the form. Problem was the default_value was being cleared by http://api.drupal.org/api/function/_system_settings_form_automatic_defau...
Comment #19
coltraneThis patch corrects the error on d7 slave site. The translated menu link was use the destination string instead of the array.
Comment #20
gregglesNow committed - #18: http://drupal.org/cvs?commit=360148 and #19: http://drupal.org/cvs?commit=360150.
Thanks for finding them and fixing them, juliangb and coltrane!
Comment #21
coltraneHere's working account repair for D7. On my D7 slave site I get an error about the stroopwafel key not being present in POST, but no code during bakery/repair should be calling bakery_taste_stroopwafel_cookie() that I can tell.
Comment #22
juliangb commentedI'm now getting a 403 on slave/user/login, rather than redirecting to master/user/login.
Comment #23
greggles@juliangb - you mean as an anonymous user?
Comment #24
coltraneyeah, @juliangb can you describe how you get a 403?
Comment #25
gregglesThe first hunk seems wrong to me:
Do we need to count or just say "is there at least one record?" If we need to count, we should use a sql count(1) style query. If it's a test for "at least one record" we should do a range query to limit the number of rows it will scan.
Comment #26
gregglesNEVERMIND! I didn't notice the little ->countQuery() in the chain. Brilliant work.
Comment #27
coltraneI think we should move the 403 when anonymous hits user/login on slave to a new a issue.
Here's an updated patch for account repair. I'm still not certain why bakery_taste_stroopwafel_cookie() is called on bakery/repair, but this patch does an isset() to avoid the message.
Comment #28
gregglesFixed - thanks coltrane!
http://drupal.org/cvs?commit=361266
I agree about the 403 vs. redirect. I suggest we revisit that flow as a whole.
Comment #29
coltraneMinor update, the INSTALL.txt :)
Comment #30
gregglesHottest! http://drupal.org/cvs?commit=361278