[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[2261] trunk



Revision: 2261
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2261&view=rev
Author:   einhverfr
Date:     2008-08-14 15:25:48 +0000 (Thu, 14 Aug 2008)

Log Message:
-----------
Applying patch 2013331 from Jeffk on configurable cookie names

Modified Paths:
--------------
    trunk/LedgerSMB/Auth/DB.pm
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB/Sysconfig.pm
    trunk/LedgerSMB.pm
    trunk/bin/admin.pl
    trunk/ledgersmb.conf.default
    trunk/old-handler.pl
    trunk/scripts/login.pl

Modified: trunk/LedgerSMB/Auth/DB.pm
===================================================================
--- trunk/LedgerSMB/Auth/DB.pm	2008-08-13 21:11:33 UTC (rev 2260)
+++ trunk/LedgerSMB/Auth/DB.pm	2008-08-14 15:25:48 UTC (rev 2261)
@@ -89,7 +89,7 @@
               $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 @@
             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 @@
 
         #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 @@
 
     #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 @@
         __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|;
 
 }
 

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2008-08-13 21:11:33 UTC (rev 2260)
+++ trunk/LedgerSMB/Form.pm	2008-08-14 15:25:48 UTC (rev 2261)
@@ -127,7 +127,7 @@
             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;
     }

Modified: trunk/LedgerSMB/Sysconfig.pm
===================================================================
--- trunk/LedgerSMB/Sysconfig.pm	2008-08-13 21:11:33 UTC (rev 2260)
+++ trunk/LedgerSMB/Sysconfig.pm	2008-08-14 15:25:48 UTC (rev 2261)
@@ -39,6 +39,10 @@
 
 # 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 @@
 # 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};

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2008-08-13 21:11:33 UTC (rev 2260)
+++ trunk/LedgerSMB.pm	2008-08-14 15:25:48 UTC (rev 2261)
@@ -207,7 +207,7 @@
         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 @@
     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;

Modified: trunk/bin/admin.pl
===================================================================
--- trunk/bin/admin.pl	2008-08-13 21:11:33 UTC (rev 2260)
+++ trunk/bin/admin.pl	2008-08-14 15:25:48 UTC (rev 2261)
@@ -1020,7 +1020,7 @@
             $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;
         }

Modified: trunk/ledgersmb.conf.default
===================================================================
--- trunk/ledgersmb.conf.default	2008-08-13 21:11:33 UTC (rev 2260)
+++ trunk/ledgersmb.conf.default	2008-08-14 15:25:48 UTC (rev 2261)
@@ -16,6 +16,11 @@
 # 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

Modified: trunk/old-handler.pl
===================================================================
--- trunk/old-handler.pl	2008-08-13 21:11:33 UTC (rev 2260)
+++ trunk/old-handler.pl	2008-08-14 15:25:48 UTC (rev 2261)
@@ -170,7 +170,7 @@
         }
 
         #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;
         }

Modified: trunk/scripts/login.pl
===================================================================
--- trunk/scripts/login.pl	2008-08-13 21:11:33 UTC (rev 2260)
+++ trunk/scripts/login.pl	2008-08-14 15:25:48 UTC (rev 2261)
@@ -47,7 +47,7 @@
     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 @@
     }
     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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.