From 8d3466b091af302eaf6ed81deb8ff946cd04c74a Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Wed, 20 May 2015 13:52:58 -0400
Subject: [PATCH] - backported patches

---
 server/lib/classes/db_mysql.inc.php               |    3 +
 server/plugins-available/mail_plugin_dkim.inc.php |   72 ++++++++++++++++++-----------------
 install/dist/conf/debian40.conf.php               |    2 
 install/tpl/server.ini.master                     |    2 
 install/dist/conf/debian60.conf.php               |    2 
 interface/lib/classes/db_mysql.inc.php            |    3 +
 6 files changed, 46 insertions(+), 38 deletions(-)

diff --git a/install/dist/conf/debian40.conf.php b/install/dist/conf/debian40.conf.php
index 3e9fe35..613c828 100644
--- a/install/dist/conf/debian40.conf.php
+++ b/install/dist/conf/debian40.conf.php
@@ -183,7 +183,7 @@
 $conf['jailkit']['config_dir'] = '/etc/jailkit';
 $conf['jailkit']['jk_init'] = 'jk_init.ini';
 $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
-$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico';
+$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch';
 $conf['jailkit']['jailkit_chroot_cron_programs'] = '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php';
 
 //* Squid
diff --git a/install/dist/conf/debian60.conf.php b/install/dist/conf/debian60.conf.php
index e18faa4..2c26dcb 100644
--- a/install/dist/conf/debian60.conf.php
+++ b/install/dist/conf/debian60.conf.php
@@ -183,7 +183,7 @@
 $conf['jailkit']['config_dir'] = '/etc/jailkit';
 $conf['jailkit']['jk_init'] = 'jk_init.ini';
 $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
-$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico';
+$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch';
 $conf['jailkit']['jailkit_chroot_cron_programs'] = '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php';
 
 //* Squid
diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master
index 4259222..ec7fac8 100644
--- a/install/tpl/server.ini.master
+++ b/install/tpl/server.ini.master
@@ -129,7 +129,7 @@
 [jailkit]
 jailkit_chroot_home=/home/[username]
 jailkit_chroot_app_sections=basicshell editors extendedshell netutils ssh sftp scp groups jk_lsh
-jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico
+jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch
 jailkit_chroot_cron_programs=/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php
 
 [vlogger]
diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php
index 116af65..08a224f 100644
--- a/interface/lib/classes/db_mysql.inc.php
+++ b/interface/lib/classes/db_mysql.inc.php
@@ -55,7 +55,9 @@
 	private $autoCommit = 1;    // Autocommit Transactions
 	private $currentRow;  // current row number
 	private $errorNumber = 0; // last error number
+	*/
 	public $errorMessage = ''; // last error message
+	/*
 	private $errorLocation = '';// last error location
 	private $isConnected = false; // needed to know if we have a valid mysqli object from the constructor
 	////
@@ -503,6 +505,7 @@
 
 		$mysql_error = (is_object($this->_iConnId) ? mysqli_error($this->_iConnId) : mysqli_connect_error());
 		$mysql_errno = (is_object($this->_iConnId) ? mysqli_errno($this->_iConnId) : mysqli_connect_errno());
+		$this->errorMessage = $mysql_error;
 
 		//$sAddMsg .= getDebugBacktrace();
 
diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index 67bf7c4..bf43519 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -55,7 +55,9 @@
 	private $autoCommit = 1;    // Autocommit Transactions
 	private $currentRow;  // current row number
 	public $errorNumber = 0; // last error number
+	*/
 	public $errorMessage = ''; // last error message
+	/*
 	private $errorLocation = '';// last error location
 	private $isConnected = false; // needed to know if we have a valid mysqli object from the constructor
 	////
@@ -467,6 +469,7 @@
 
 		$mysql_error = (is_object($this->_iConnId) ? mysqli_error($this->_iConnId) : mysqli_connect_error());
 		$mysql_errno = (is_object($this->_iConnId) ? mysqli_errno($this->_iConnId) : mysqli_connect_errno());
+		$this->errorMessage = $mysql_error;
 
 		//$sAddMsg .= getDebugBacktrace();
 
diff --git a/server/plugins-available/mail_plugin_dkim.inc.php b/server/plugins-available/mail_plugin_dkim.inc.php
index 2842551..7ded684 100755
--- a/server/plugins-available/mail_plugin_dkim.inc.php
+++ b/server/plugins-available/mail_plugin_dkim.inc.php
@@ -325,7 +325,7 @@
 					$this->remove_dkim_key($mail_config['dkim_path']."/".$data['new']['domain'], $data['new']['domain']);
 				}
 			} else {
-				$app->log('Error saving the DKIM Private-key for '.$data['new']['domain'].' - DKIM is not enabled for the domain.', LOGLEVEL_ERROR);
+				$app->log('Error saving the DKIM Private-key for '.$data['new']['domain'].' - DKIM is not enabled for the domain.', LOGLEVEL_DEBUG);
 			}
 		}
 	}
@@ -369,44 +369,46 @@
 	 */
 	function domain_dkim_update($event_name, $data) {
 		global $app;
-		if ($this->check_system($data)) {
-			/* maildomain disabled */
-			if ($data['new']['active'] == 'n' && $data['old']['active'] == 'y' && $data['new']['dkim']=='y') {
-				$app->log('Maildomain '.$data['new']['domain'].' disabled - remove DKIM-settings', LOGLEVEL_DEBUG);
-				$this->remove_dkim($data['new']);
-			}
-			/* maildomain re-enabled */
-			if ($data['new']['active'] == 'y' && $data['old']['active'] == 'n' && $data['new']['dkim']=='y') 
-				$this->add_dkim($data);
-
-			/* maildomain active - only dkim changes */
-			if ($data['new']['active'] == 'y' && $data['old']['active'] == 'y') {
-				/* dkim disabled */
-				if ($data['new']['dkim'] != $data['old']['dkim'] && $data['new']['dkim'] == 'n') {
+		if($data['new']['dkim'] == 'y' || $data['old']['dkim'] == 'y'){
+			if ($this->check_system($data)) {
+				/* maildomain disabled */
+				if ($data['new']['active'] == 'n' && $data['old']['active'] == 'y' && $data['new']['dkim']=='y') {
+					$app->log('Maildomain '.$data['new']['domain'].' disabled - remove DKIM-settings', LOGLEVEL_DEBUG);
 					$this->remove_dkim($data['new']);
 				}
-				/* dkim enabled */
-				elseif ($data['new']['dkim'] != $data['old']['dkim'] && $data['new']['dkim'] == 'y') {
+				/* maildomain re-enabled */
+				if ($data['new']['active'] == 'y' && $data['old']['active'] == 'n' && $data['new']['dkim']=='y') 
 					$this->add_dkim($data);
-				}
-				/* new private-key */
-				if ($data['new']['dkim_private'] != $data['old']['dkim_private'] && $data['new']['dkim'] == 'y') {
-					$this->add_dkim($data);
-				}
-				/* new selector */
-				if ($data['new']['dkim_selector'] != $data['old']['dkim_selector'] && $data['new']['dkim'] == 'y') {
-					$this->add_dkim($data);
-				}
-				/* new domain-name */
-				if ($data['new']['domain'] != $data['old']['domain']) {
-					$this->remove_dkim($data['old']);
-					$this->add_dkim($data);
-				}
-			}
 
-			/* resync */
-			if ($data['new']['active'] == 'y' && $data['new'] == $data['old'] && $data['new']['dkim']=='y') {
-				$this->add_dkim($data);
+				/* maildomain active - only dkim changes */
+				if ($data['new']['active'] == 'y' && $data['old']['active'] == 'y') {
+					/* dkim disabled */
+					if ($data['new']['dkim'] != $data['old']['dkim'] && $data['new']['dkim'] == 'n') {
+						$this->remove_dkim($data['new']);
+					}
+					/* dkim enabled */
+					elseif ($data['new']['dkim'] != $data['old']['dkim'] && $data['new']['dkim'] == 'y') {
+						$this->add_dkim($data);
+					}
+					/* new private-key */
+					if ($data['new']['dkim_private'] != $data['old']['dkim_private'] && $data['new']['dkim'] == 'y') {
+						$this->add_dkim($data);
+					}
+					/* new selector */
+					if ($data['new']['dkim_selector'] != $data['old']['dkim_selector'] && $data['new']['dkim'] == 'y') {
+						$this->add_dkim($data);
+					}
+					/* new domain-name */
+					if ($data['new']['domain'] != $data['old']['domain']) {
+						$this->remove_dkim($data['old']);
+						$this->add_dkim($data);
+					}
+				}
+
+				/* resync */
+				if ($data['new']['active'] == 'y' && $data['new'] == $data['old'] && $data['new']['dkim']=='y') {
+					$this->add_dkim($data);
+				}
 			}
 		}
 	}

--
Gitblit v1.9.1