Merge branch 'bug-1360' into testserver-stable
authorBenny Baumann <BenBE@geshi.org>
Fri, 16 Jan 2015 17:54:46 +0000 (18:54 +0100)
committerBenny Baumann <BenBE@geshi.org>
Fri, 16 Jan 2015 17:54:46 +0000 (18:54 +0100)
CommModule/client.pl

index 9d32469..08d7c6e 100755 (executable)
@@ -1087,15 +1087,20 @@ sub HandleGPG()
 
     my $prefix="gpg";
     my $short=int($row{'id'}/1000);
-    my $csrname = "../csr/$prefix-".$row{'id'}.".csr";
-    $csrname = "../csr/$prefix/$short/$prefix-".$row{'id'}.".csr" if($newlayout);
-    SysLog("New Layout: "."../csr/$prefix/$short/$prefix-".$row{'id'}.".csr\n");
+
+    my $dirname="../csr";
+    $dirname="../csr/$prefix/$short" if ($newlayout);
+
+    #Ensure the directory exists
+    mkdir $dirname, 0755;
+
+    my $csrname = "$dirname/$prefix-".$row{'id'}.".csr";
+    SysLog("New Layout: $csrname\n");
 
     #my $crtname = "../crt/$prefix-".$row{'id'}.".crt";
     my $crtname=$csrname; $crtname=~s/^\.\.\/csr/..\/crt/; $crtname=~s/\.csr$/.crt/;
     SysLog("New Layout: $crtname\n");
 
-
     #my $csrname = "../csr/gpg-".$row{'id'}.".csr";
     #my $crtname = "../crt/gpg-".$row{'id'}.".crt";