X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fhtml%2FElements%2FSetupSessionCookie;h=3225c0d8c502cc4f6157991225b625aaddc64f80;hp=087f8250e0fcada49743a13652b58e603b3dee19;hb=75162bb14b3e38d66617077843f4dfdcaf09d5c4;hpb=ef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4 diff --git a/rt/html/Elements/SetupSessionCookie b/rt/html/Elements/SetupSessionCookie index 087f8250e..3225c0d8c 100644 --- a/rt/html/Elements/SetupSessionCookie +++ b/rt/html/Elements/SetupSessionCookie @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -24,7 +24,7 @@ %# along with this program; if not, write to the Free Software %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA %# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -50,7 +50,7 @@ return if $m->is_subrequest; # avoid reentrancy, as suggested by masonbook my %cookies = CGI::Cookie->fetch(); my $cookiename = "RT_SID_" . $RT::rtname . "." . $ENV{'SERVER_PORT'}; -$SessionCookie ||= $cookies{$cookiename} ? $cookies{$cookiename}->value : undef; +$SessionCookie = $cookies{$cookiename} ? $cookies{$cookiename}->value : undef; my %backends = ( mysql => 'Apache::Session::MySQL', @@ -76,11 +76,13 @@ if ( $session_class eq 'Apache::Session::File' ) { $session_properties = { Directory => $RT::MasonSessionDir, LockDirectory => $RT::MasonSessionDir, + Transaction => 1 }; } else { $session_properties = { Handle => $RT::Handle->dbh, LockHandle => $RT::Handle->dbh, + Transaction => 1 }; } @@ -95,6 +97,13 @@ if ($@) { undef $cookies{$cookiename}; }; } +elsif ( !($session{'CurrentUser'} && $session{'CurrentUser'}->id) ) { + eval { + undef $cookies{$cookiename}; + tied(%session)->delete; + tie %session, $session_class, undef, $session_properties; + } +} if ($@) { die loc("RT couldn't store your session.") . "\n"