From 572d0ac2b5ade838a703da9c92edc66775840454 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 3 Dec 2014 11:45:55 -0700 Subject: [PATCH 1/2] [vacation_sieve] Set permissions properly when creating local directories --- plugins/vacation_sieve/transfer/local.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/vacation_sieve/transfer/local.php b/plugins/vacation_sieve/transfer/local.php index 01562c8..d40b97a 100644 --- a/plugins/vacation_sieve/transfer/local.php +++ b/plugins/vacation_sieve/transfer/local.php @@ -24,7 +24,7 @@ public function SaveScript($path,$script) # Create the folder if not exists if ( !is_dir($folder) ) - $try = @mkdir($folder,true); + $try = @mkdir($folder,0755,true); if ( !$try ) { From a807e96b2b865d73a5718c3d31301be809a3983d Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 3 Dec 2014 16:32:16 -0700 Subject: [PATCH 2/2] [vacation_sieve] Fix running of sievec and add error handling --- plugins/vacation_sieve/transfer/local.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/vacation_sieve/transfer/local.php b/plugins/vacation_sieve/transfer/local.php index d40b97a..ac3f632 100644 --- a/plugins/vacation_sieve/transfer/local.php +++ b/plugins/vacation_sieve/transfer/local.php @@ -43,8 +43,16 @@ public function SaveScript($path,$script) } # Compile the script - if ( $success ) - $success = (system("$this->params['sievecbin'] $path") == 0); + if ( $success && $this->params['sievecbin'] != '' ) + { + $output = system($this->params['sievecbin'] . " $path 2>&1", $rc); + $success = ($rc == 0); + if ( !$success ) + { + $msg = sprintf('Cannot execute "%s" to compile the script: %s', $this->params['sievecbin'], $output); + throw new Exception($msg); + } + } return $success; }