]> git.proxmox.com Git - pmg-api.git/commitdiff
PMG/MailQueue.pm: fix create_spooldirs
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 21 Apr 2017 07:44:04 +0000 (09:44 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 21 Apr 2017 07:44:04 +0000 (09:44 +0200)
PMG/MailQueue.pm
bin/pmg-smtp-filter

index 9ae6721e26ed2250bee40c13e37d90e4c5b61c8e..132b042f42742acf356eaa1385809ce7958d01bd 100644 (file)
@@ -19,9 +19,21 @@ our $spooldir = "/var/spool/pmg";
 
 my $fileseq = rand 1000;
 
-sub create_sppoldirs {
+sub create_spooldirs {
+    my ($lcid, $cleanup) = @_;
+
+    # if requested, remove any stale date
+    File::Path::remove_tree(
+       "$spooldir/cluster", "$spooldir/active",
+       "$spooldir/virus", "$spooldir/spam") if $cleanup;
+
     File::Path::make_path(
        "$spooldir/active", "$spooldir/spam", "$spooldir/virus");
+
+    if ($lcid) {
+       mkpath "$spooldir/cluster/$lcid/virus";
+       mkpath "$spooldir/cluster/$lcid/spam";
+    }
 }
 
 # called on service startup to remove any stale files
@@ -256,12 +268,9 @@ sub quarantine_mail {
 
     eval {
        if ($lcid) {
-           if ($qtype eq 'V') {
-               mkpath "$spooldir/cluster/$lcid/virus";
-           } else {
-               mkpath "$spooldir/cluster/$lcid/spam";
-           }
-           ($fh, $uid, $path) = new_fileid ($spooldir, "cluster/$lcid/$subpath");
+           my $subdir = "cluster/$lcid/$subpath";
+           mkpath $subdir;
+           ($fh, $uid, $path) = new_fileid ($spooldir, $subdir);
        } else {
            ($fh, $uid, $path) = new_fileid ($spooldir, $subpath);
        }
index a33316351f1368103cff94b56a86cac1dded9701..372a399529da8a4bcc059445cb51dc6de017ec26 100755 (executable)
@@ -81,7 +81,7 @@ my $max_spare_servers = 0;
 my $max_requests = 1;
 
 # create spool directories
-PMG::MailQueue::create_sppoldirs();
+PMG::MailQueue::create_spooldirs();
 
 if (!$opt_testmode) {