summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB.pm4
-rwxr-xr-xLedgerSMB/Auth/DB.pm10
-rw-r--r--LedgerSMB/Form.pm2
-rw-r--r--LedgerSMB/Sysconfig.pm6
-rw-r--r--bin/admin.pl2
-rw-r--r--ledgersmb.conf.default5
-rwxr-xr-xold-handler.pl2
-rw-r--r--scripts/login.pl4
8 files changed, 22 insertions, 13 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm
index 9239cd50..61293a2b 100755
--- a/LedgerSMB.pm
+++ b/LedgerSMB.pm
@@ -207,7 +207,7 @@ sub new {
return $self;
}
if (!$self->{company} && $self->is_run_mode('cgi', 'mod_perl')){
- my $ccookie = $cookie{LedgerSMB};
+ my $ccookie = $cookie{${LedgerSMB::Sysconfig::cookie_name}};
$ccookie =~ s/.*:([^:]*)$/$1/;
$self->{company} = $ccookie;
}
@@ -217,7 +217,7 @@ sub new {
if ($self->is_run_mode('cgi', 'mod_perl')) {
#check for valid session unless this is an inital authentication
#request -- CT
- if (!LedgerSMB::Auth::session_check( $cookie{"LedgerSMB"}, $self) ) {
+ if (!LedgerSMB::Auth::session_check( $cookie{${LedgerSMB::Sysconfig::cookie_name}}, $self) ) {
print STDERR "Session did not check";
$self->_get_password("Session Expired");
exit;
diff --git a/LedgerSMB/Auth/DB.pm b/LedgerSMB/Auth/DB.pm
index 7febf0b1..9afc8675 100755
--- a/LedgerSMB/Auth/DB.pm
+++ b/LedgerSMB/Auth/DB.pm
@@ -89,7 +89,7 @@ sub session_check {
$session_ref->{session_id} . ':' . $session_ref->{token} . ':' . $form->{company};
#now update the cookie in the browser
- print qq|Set-Cookie: LedgerSMB=$newCookieValue; path=$path;\n|;
+ print qq|Set-Cookie: ${LedgerSMB::Sysconfig::cookie_name}=$newCookieValue; path=$path;\n|;
return 1;
}
@@ -100,7 +100,7 @@ sub session_check {
my $sessionDestroy = $dbh->prepare("");
#delete the cookie in the browser
- print qq|Set-Cookie: LedgerSMB=; path=$path;\n|;
+ print qq|Set-Cookie: ${LedgerSMB::Sysconfig::cookie_name}=; path=$path;\n|;
return 0;
}
@@ -109,7 +109,7 @@ sub session_check {
#cookie is not valid
#delete the cookie in the browser
- print qq|Set-Cookie: LedgerSMB=; path=$path;\n|;
+ print qq|Set-Cookie: ${LedgerSMB::Sysconfig::cookie_name}=; path=$path;\n|;
return 0;
}
}
@@ -197,7 +197,7 @@ sub session_create {
#now set the cookie in the browser
#TODO set domain from ENV, also set path to install path
- print qq|Set-Cookie: LedgerSMB=$newCookieValue; path=$path;\n|;
+ print qq|Set-Cookie: ${LedgerSMB::Sysconfig::cookie_name}=$newCookieValue; path=$path;\n|;
$lsmb->{LedgerSMB} = $newCookieValue;
$lsmb->{dbh}->commit;
}
@@ -222,7 +222,7 @@ sub session_destroy {
__FILE__ . ':' . __LINE__ . ': Delete from session: ' );
#delete the cookie in the browser
- print qq|Set-Cookie: LedgerSMB=; path=/;\n|;
+ print qq|Set-Cookie: ${LedgerSMB::Sysconfig::cookie_name}=; path=/;\n|;
}
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 3d43b8a6..f9ae6ad5 100644
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -127,7 +127,7 @@ sub new {
my ( $name, $value ) = split /=/, $_, 2;
$cookie{$name} = $value;
}
- my $ccookie = $cookie{LedgerSMB};
+ my $ccookie = $cookie{${LedgerSMB::Sysconfig::cookie_name}};
$ccookie =~ s/.*:([^:]*)$/$1/;
$self->{company} = $ccookie;
}
diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm
index f14b3f01..b2fc1a93 100644
--- a/LedgerSMB/Sysconfig.pm
+++ b/LedgerSMB/Sysconfig.pm
@@ -39,6 +39,10 @@ $max_post_size = 1024 * 1024;
# defaults to 2-- default number of places to round amounts to
$decimal_places = 2;
+
+# defaults to LedgerSMB-1.3 - default spelling of cookie
+$cookie_name = "LedgerSMB-1.3";
+
# spool directory for batch printing
$spool = "spool";
@@ -88,7 +92,7 @@ read_config( 'ledgersmb.conf' => %config ) or die;
# Root variables
for $var (
qw(pathsep logging check_max_invoices language auth latex
- db_autoupdate force_username_case max_post_size decimal_places)
+ db_autoupdate force_username_case max_post_size decimal_places cookie_name)
)
{
${$var} = $config{''}{$var} if $config{''}{$var};
diff --git a/bin/admin.pl b/bin/admin.pl
index c1fa2156..48101960 100644
--- a/bin/admin.pl
+++ b/bin/admin.pl
@@ -1020,7 +1020,7 @@ sub check_password {
$cookie{$name} = $value;
}
- if ( !Session::session_check( $cookie{"LedgerSMB"}, $root ) ) {
+ if ( !Session::session_check( $cookie{${LedgerSMB::Sysconfig::cookie_name}}, $root ) ) {
&adminlogin( $locale->text('Session expired!') );
exit;
}
diff --git a/ledgersmb.conf.default b/ledgersmb.conf.default
index 29bd705d..e8b7c83d 100644
--- a/ledgersmb.conf.default
+++ b/ledgersmb.conf.default
@@ -16,6 +16,11 @@ max_post_size : 4194304
# Define global settings for decimal places
decimal_places : 2
+# Spelling of cookie name for this instance of LedgerSMB.
+# Used to keep multiple instances and/or different versions
+# logged in at the same time
+cookie_name : LedgerSMB-1.3
+
[environment]
# If the server can't find applications, append to the path
PATH: /usr/local/pgsql/bin
diff --git a/old-handler.pl b/old-handler.pl
index f5619adf..886882ed 100755
--- a/old-handler.pl
+++ b/old-handler.pl
@@ -170,7 +170,7 @@ sub check_password {
}
#check for valid session
- if ( !LedgerSMB::Auth::session_check( $cookie{"LedgerSMB"}, $form ) ) {
+ if ( !LedgerSMB::Auth::session_check( $cookie{${LedgerSMB::Sysconfig::cookie_name}}, $form ) ) {
&getpassword(1);
exit;
}
diff --git a/scripts/login.pl b/scripts/login.pl
index 02a188cf..ea0cf652 100644
--- a/scripts/login.pl
+++ b/scripts/login.pl
@@ -47,7 +47,7 @@ sub authenticate {
if ($request->{dbh} && $request->{next}) {
print "Content-Type: text/html\n";
- print "Set-Cookie: LedgerSMB=Login; path=$path\n";
+ print "Set-Cookie: ${LedgerSMB::Sysconfig::cookie_name}=Login; path=$path\n";
print "Status: 302 Found\n";
print "Location: ".$path.$request->{next}."\n";
print "\n";
@@ -55,7 +55,7 @@ sub authenticate {
}
elsif ($request->{dbh} || $request->{log_out}){
print "Content-Type: text/html\n";
- print "Set-Cookie: LedgerSMB=Login; path=$path\n";
+ print "Set-Cookie: ${LedgerSMB::Sysconfig::cookie_name}=Login; path=$path\n";
print "Status: 200 Success\n\n";
if ($request->{log_out}){
exit;