From b9a3ef486ebcde18a5ade37865ff8f397185d24f Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Sun, 24 Jul 2016 05:30:59 -0400
Subject: [PATCH] Fixed #3979 Mailbox users unable to save autoresponders

---
 install/dist/lib/centos_base.lib.php |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/install/dist/lib/centos_base.lib.php b/install/dist/lib/centos_base.lib.php
index 15074d4..d6deb7e 100644
--- a/install/dist/lib/centos_base.lib.php
+++ b/install/dist/lib/centos_base.lib.php
@@ -33,7 +33,7 @@
 	protected $clamav_socket = '/tmp/clamd.socket';
 	
 	public function configure_amavis() {
-		global $conf;
+		global $conf, $dist;
 
 		// amavisd user config file
 		$configfile = 'fedora_amavisd_conf';
@@ -50,6 +50,12 @@
 		$content = str_replace('/var/spool/amavisd/clamd.sock', $this->clamav_socket, $content);
 		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
 		chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640);
+		
+		// for CentOS 7.2 only
+		if($dist['confid'] == 'centos72') {
+			chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0750);
+			chgrp($conf['amavis']['config_dir'].'/amavisd.conf', 'amavis');
+		}
 
 
 		// Adding the amavisd commands to the postfix configuration
@@ -70,22 +76,9 @@
 		$config_dir = $conf['postfix']['config_dir'];
 
 		// Adding amavis-services to the master.cf file if the service does not already exists
-		if ($this->postfix_master()) {
-			exec ("postconf -M amavis.unix &> /dev/null", $out, $ret);
-			$add_amavis = @($out[0]=='')?true:false;
-			unset($out);
-			exec ("postconf -M 127.0.0.1:10025.inet &> /dev/null", $out, $ret);
-			$add_amavis_10025 = @($out[0]=='')?true:false;
-			unset($out);
-			exec ("postconf -M 127.0.0.1:10027.inet &> /dev/null", $out, $ret);
-			$add_amavis_10027 = @($out[0]=='')?true:false;
-			unset($out);
-		} else { //* fallback - postfix < 2.9
-			$content = rf($conf['postfix']['config_dir'].'/master.cf');
-			$add_amavis = @(!preg_match('/^amavis\s+unix\s+/m', $content))?true:false;
-			$add_amavis_10025 = @(!preg_match('/^127.0.0.1:10025\s+/m', $content))?true:false;
-			$add_amavis_10027 = @(!preg_match('/^127.0.0.1:10027\s+/m', $content))?true:false;
-		}
+		$add_amavis = !$this->get_postfix_service('amavis','unix');
+		$add_amavis_10025 = !$this->get_postfix_service('127.0.0.1:10025','inet');
+		$add_amavis_10027 = !$this->get_postfix_service('127.0.0.1:10027','inet');
 
 		if ($add_amavis || $add_amavis_10025 || $add_amavis_10027) {
 			//* backup master.cf

--
Gitblit v1.9.1