summaryrefslogtreecommitdiff
path: root/CommModule
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2015-01-16 18:53:02 +0100
committerBenny Baumann <BenBE@geshi.org>2015-01-16 18:53:02 +0100
commitf0e4a1185a0c0da3f1bf3c3eec2f45dfe08172ca (patch)
tree731e59e011b5965fd527636022d2d17506c8d4d0 /CommModule
parent00ae63b22b97efbe5702bf346b3d87d0353cd09d (diff)
downloadcacert-devel-f0e4a1185a0c0da3f1bf3c3eec2f45dfe08172ca.tar.gz
cacert-devel-f0e4a1185a0c0da3f1bf3c3eec2f45dfe08172ca.tar.xz
cacert-devel-f0e4a1185a0c0da3f1bf3c3eec2f45dfe08172ca.zip
bug 1360: Reorder code to have a single point to create a directory for storage as needed
Diffstat (limited to 'CommModule')
-rwxr-xr-xCommModule/client.pl12
1 files changed, 9 insertions, 3 deletions
diff --git a/CommModule/client.pl b/CommModule/client.pl
index 25e6a73..99918a0 100755
--- a/CommModule/client.pl
+++ b/CommModule/client.pl
@@ -1060,9 +1060,15 @@ 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/;