From 1110abef9e72d616ec0c6d0c987c6902ce6970f0 Mon Sep 17 00:00:00 2001
From: Jesse Norell <jesse@kci.net>
Date: Fri, 25 Sep 2020 16:36:39 -0600
Subject: [PATCH] address verification not needed for rspamd

---
 install/lib/installer_base.lib.php                     | 5 ++++-
 server/plugins-available/postfix_server_plugin.inc.php | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 22f9c78388..dfd0842568 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -391,6 +391,9 @@ class installer_base {
 			}
 		}
 
+		// preserve needed values in $conf  (should just array_merge $tpl_ini_array into $conf?)
+		$conf['mail']['content_filter'] = $tpl_ini_array['mail']['content_filter'];
+
 		$server_ini_content = array_to_ini($tpl_ini_array);
 
 		$mail_server_enabled = ($conf['services']['mail'])?1:0;
@@ -1475,7 +1478,7 @@ class installer_base {
 			}
 			$new_options[] = $value;
 		}
-		if ($configure_lmtp) {
+		if ($configure_lmtp && $conf['mail']['content_filter'] === 'amavisd') {
 			for ($i = 0; isset($new_options[$i]); $i++) {
 				if ($new_options[$i] == 'reject_unlisted_recipient') {
 					array_splice($new_options, $i+1, 0, array("check_recipient_access proxy:mysql:${quoted_config_dir}/mysql-verify_recipients.cf"));
diff --git a/server/plugins-available/postfix_server_plugin.inc.php b/server/plugins-available/postfix_server_plugin.inc.php
index 2d6f063cd8..34a8509e4f 100644
--- a/server/plugins-available/postfix_server_plugin.inc.php
+++ b/server/plugins-available/postfix_server_plugin.inc.php
@@ -326,7 +326,7 @@ class postfix_server_plugin {
 			}
 			$new_options[] = $value;
 		}
-		if (defined($configure_lmtp) && $configure_lmtp) {
+		if (defined($configure_lmtp) && $configure_lmtp && $mail_config['content_filter'] == 'amavisd') {
 			for ($i = 0; isset($new_options[$i]); $i++) {
 				if ($new_options[$i] == 'reject_unlisted_recipient') {
 					array_splice($new_options, $i+1, 0, array("check_recipient_access proxy:mysql:${quoted_postfix_config_dir}/mysql-verify_recipients.cf"));
-- 
GitLab