Bug 18578: Use subdirectory in /tmp for session storage during installation
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 11 May 2017 07:10:50 +0000 (09:10 +0200)
committerJulian Maurice <julian.maurice@biblibre.com>
Mon, 22 May 2017 14:28:03 +0000 (16:28 +0200)
Apply the change from bug 15553 to InstallAuth.pm too.

Test plan:
[1] Remove all cgisess_* files from your /tmp directory.
[2] Remove directory /tmp/cgisess_koha_[your instance], if there.
[3] Run the webinstaller
    /cgi-bin/koha/installer/install.pl?step=1&op=updatestructure
[4] Check if you have cgisess_ files in /tmp/cgisess_koha_[your instance].

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit c9de665c294f0e4416a9f1ea751e2859eb065a9c)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
(cherry picked from commit 5d745a88f0450320493b7e33371b53799d87f677)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

C4/InstallAuth.pm

index aa90b35..2c498a0 100644 (file)
@@ -20,6 +20,7 @@ package C4::InstallAuth;
 use strict;
 #use warnings; FIXME - Bug 2505
 use Digest::MD5 qw(md5_base64);
+use File::Spec;
 
 require Exporter;
 use C4::Context;
@@ -235,6 +236,7 @@ sub checkauth {
     my $dbh = C4::Context->dbh();
     my $template_name;
     $template_name = "installer/auth.tt";
+    my $sessdir = File::Spec->catdir( File::Spec->tmpdir, 'cgisess_' . C4::Context->config('database') ); # same construction as in C4/Auth
 
     # state variables
     my $loggedin = 0;
@@ -245,7 +247,7 @@ sub checkauth {
         C4::Context->_new_userenv($sessionID);
         my $session =
           new CGI::Session( "driver:File;serializer:yaml", $sessionID,
-            { Directory => '/tmp' } );
+            { Directory => $sessdir } );
         if ( $session->param('cardnumber') ) {
             C4::Context->set_userenv(
                 $session->param('number'),
@@ -285,7 +287,7 @@ sub checkauth {
     }
     unless ($userid) {
         my $session =
-          new CGI::Session( "driver:File;serializer:yaml", undef, { Directory => '/tmp' } );
+          new CGI::Session( "driver:File;serializer:yaml", undef, { Directory => $sessdir } );
         $sessionID = $session->id;
         $userid    = $query->param('userid');
         C4::Context->_new_userenv($sessionID);