Attached patch will enabled PL across multisite on subdomains, if:
- session.cookie_domain is set in settings.php, like so:
ini_set('session.cookie_domain', "example.com"); - user and persistent_login tables are shared between multisites
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | persistent_login-127359-9.patch | 1.81 KB | markus_petrux |
| #8 | persistent_login-127359-8.patch | 1.63 KB | markus_petrux |
| #4 | persistent_login_multisite_2.patch | 1.15 KB | frjo |
| #2 | 4.7-pl-domain.patch | 1.03 KB | bjaspan |
| #1 | pl-domain.patch | 1.03 KB | bjaspan |
Comments
Comment #1
bjaspan commentedYour patch introduces a security hole by allowing HTTP header injection via the Host header. Instead of trying to sanitize $_SERVER['HTTP_HOST'], I suggest using session.cookie_domain if it is set and the default value (by specifying the empty string) if it is unset.
So, try the attached patch and let me know if it works.
Comment #2
bjaspan commentedI just noticed you submitted this issue against the 4.7 version of PL. So, use this patch instead.
Comment #3
moshe weitzman commentedseems like a useful feature. i run groups.drupal.org and groupsbeta.drupal.org so this could affect me slightly.
Comment #4
frjo commentedThanks for this solution ahoeben!
I have just implemented a slightly modified version of it for a customer and it seems to work well. The sites are running Drupal 5.5.
In later versions of Drupal 5 you have this line in settings.php.
My patch tells Persistent Login module to use the "cookie_domain" variable when it sets its cookie.
I have set the "cookie_domain" to the same domain.tld for the two sites and I'm sharing the following tables.
Before this the sites used the Singlesignon module and it worked but we got cache related problems, blank pages, for anonymus users.
Comment #5
markus_petrux commentedLatest solution looks good, though patch does not apply.
Comment #6
markus_petrux commentedOh, setcookie() is also used to expire the PL cookie at logout time.
Comment #7
markus_petrux commentedOh, here's more food for thinking... wouldn't it be nice to compute the PL cookie in a similar way the Drupal session cookie name is computed, just prefixed with 'PLSESS' or something similar?
Drupal session name is based on $cookie_domain or the host name in $base_url if cookie domain is undefined on bootstrap session phase.
Comment #8
markus_petrux commentedRe-rolled patch from #4, but also using $cookie_domain when setcookie is invoked to remove the PL at user logout time.
Attached patch is for the 5.x version of the PL module.
Comment #9
markus_petrux commentedAttached patch is the same as above, but for the 6.x version of the PL module (actually HEAD).
Comment #10
markus_petrux commentedFixed in CVS for D5 and D6 versions of PL.