A strange effect with user login

Author Message

Volker Lenz

Monday 03 March 2003 5:00:28 am

With ezp3-rc2 I observe a strange effect which I had not faced before. I could not trace the source of this, so I like to post it here in the hope for some hint:

When logging in to a non-public site with RequireUserLogin-flag set, it sometimes (I still do not know under which circumstances) happens that a user's first attempt to login with VALID (!!) credentials for the site results in a shadow-login to the PUBLIC site. However, the user receives another login screen without any warning or so for the non-public site he wants to access. If he enters his credentials again, he gets in as expected.

I found that the effect occurs when ezp runs php-sessions.

Any ideas ?

Volker Lenz

Tuesday 04 March 2003 2:55:36 am

> With ezp3-rc2 I observe a strange effect which I had not
> faced before. I could not trace the source of this, so I
> like to post it here in the hope for some hint:
>
> When logging in to a non-public site with
> RequireUserLogin-flag set, it sometimes (I still do not know
> under which circumstances) happens that a user's first
> attempt to login with VALID (!!) credentials for the site
> results in a shadow-login to the PUBLIC site. However, the
> user receives another login screen without any warning or so
> for the non-public site he wants to access. If he enters his
> credentials again, he gets in as expected.
>
> I found that the effect occurs when ezp runs php-sessions.
>
>
> Any ideas ?

Additional findings:

Effect occurs once each time you close & reopen your webbrowser.

As far as I see, the effect of a "shadow login" is somehow related to php session management. I have cookie-less sessions enabled in my php.ini. Thus, ezp sessions won't place session cookies and anonymous users are confronted with session-id's added to template hrefs on the first page request in a new browser window.

However, after the first page reload in a -- NEW -- browser window, the PHPSESSID dissapears from uri-requests and I wonder where it goes ??!!

Once the PHPSESSID has gone, the shadow login problem vanishes, too. Any clue ?

Volker Lenz

Thursday 06 March 2003 1:18:10 am

> > With ezp3-rc2 I observe a strange effect which I had not
> > faced before. I could not trace the source of this, so I
> > like to post it here in the hope for some hint:
> >
> > When logging in to a non-public site with
> > RequireUserLogin-flag set, it sometimes (I still do not
> know
> > under which circumstances) happens that a user's first
> > attempt to login with VALID (!!) credentials for the
> site
> > results in a shadow-login to the PUBLIC site. However,
> the
> > user receives another login screen without any warning or
> so
> > for the non-public site he wants to access. If he enters
> his
> > credentials again, he gets in as expected.
> >
> > I found that the effect occurs when ezp runs
> php-sessions.
> >
> >
> > Any ideas ?
>
> Additional findings:
>
> Effect occurs once each time you close & reopen your
> webbrowser.
>
> As far as I see, the effect of a "shadow login" is somehow
> related to php session management. I have cookie-less
> sessions enabled in my php.ini. Thus, ezp sessions won't
> place session cookies and anonymous users are confronted
> with session-id's added to template hrefs on the first page
> request in a new browser window.
>
> However, after the first page reload in a -- NEW -- browser
> window, the PHPSESSID dissapears from uri-requests and I
> wonder where it goes ??!!
>
> Once the PHPSESSID has gone, the shadow login problem
> vanishes, too. Any clue ?

Ok, this one is clarified:

If you have more than one domain on your system, php session manager sets an individual session cookie for each of these domains unless you specify otherwise in php.ini.

Now, on the first page load, the cookie is set, but cannot be immediately used as session-id container yet. Therefore, php uses PHP-session ids appended to your html til the cookie value becomes available to track a session.

If you have a link from domain1 to domain2 in one of your templates and a user presses this link immediately after having requested the page, the link will inevitably carry the php-sessionid of domain 1.
If the link to domain2 with a phpsession-id of domain1 is a link that opens a login screen, the user who logs in will NOT be logged in to domain2, but to domain1 instead, since the users login session-id belongs to domain1.

This is unwelcome and can only be resolved if you declare your session cookie valid for ALL domains. However, in order to support login-policy-restrictions in such an environment, you need to set explicit user-login-siteaccess1, user-login-siteaccess2 policies. And, most of all, you will need a patched version of ezp's index.php-file, otherwise users with all-domain session cookies will be allowed to login to all daomains even if they are denied by siteaccess-rules.

Valentin Svelland

Tuesday 17 January 2006 4:01:13 am

I've got multiple site installations on one server and I am quite familiar with this bug. Could anyone give me a good step-by-step guide to eliminate this problem?

------------------------
I made eZ run on www.eigersund.kommune.no, bjerkreim.kommune.no, lund.kommune.no and sokndal.kommune.no. Municipalities should use open source!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 11:38:43
Script start
Timing: Jan 18 2025 11:38:43
Module start 'layout'
Timing: Jan 18 2025 11:38:43
Module start 'content'
Timing: Jan 18 2025 11:38:43
Module end 'content'
Timing: Jan 18 2025 11:38:43
Script end

Main resources:

Total runtime0.0134 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.0391152.6406
Module start 'layout' 0.00470.0029 740.679739.4766
Module start 'content' 0.00760.0038 780.156397.3672
Module end 'content' 0.01140.0019 877.523438.3047
Script end 0.0133  915.8281 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002417.9924140.0002
Check MTime0.00118.1981140.0001
Mysql Total
Database connection0.00074.918510.0007
Mysqli_queries0.002417.898130.0008
Looping result0.00000.119210.0000
Template Total0.001611.910.0016
Template load0.00086.299410.0008
Template processing0.00075.582210.0007
Override
Cache load0.00054.044810.0005
General
dbfile0.00021.777780.0000
String conversion0.00000.069440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs