From f0720ef4c478cc505ca3492caf8bab7a55ce2517 Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Fri, 07 Mar 2014 02:29:39 -0500
Subject: [PATCH] corrected do not change the order in smtpd_recipient_restrictions when updating RBLs

---
 server/plugins-available/postfix_server_plugin.inc.php |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/server/plugins-available/postfix_server_plugin.inc.php b/server/plugins-available/postfix_server_plugin.inc.php
index ad92dec..fd9fd5a 100644
--- a/server/plugins-available/postfix_server_plugin.inc.php
+++ b/server/plugins-available/postfix_server_plugin.inc.php
@@ -109,6 +109,7 @@
 		}
 
 		if($mail_config['realtime_blackhole_list'] != $old_ini_data['mail']['realtime_blackhole_list']) {
+			$rbl_updated = false;
 			$rbl_hosts = trim(preg_replace('/\s+/', '', $mail_config['realtime_blackhole_list']));
 			if($rbl_hosts != ''){
 				$rbl_hosts = explode(",", $rbl_hosts);
@@ -117,9 +118,18 @@
 			foreach ($options as $key => $value) {
 				if (!preg_match('/reject_rbl_client/', $value)) {
 					$new_options[] = $value;
+				} else {
+					if(is_array($rbl_hosts) && !empty($rbl_hosts) && !$rbl_updated){
+						$rbl_updated = true;
+						foreach ($rbl_hosts as $key => $value) {
+							$value = trim($value);
+							if($value != '') $new_options[] = "reject_rbl_client ".$value;
+						}
+					}
 				}
 			}
-			if(is_array($rbl_hosts) && !empty($rbl_hosts)){
+			//* first time add rbl-list
+			if (!$rbl_updated && is_array($rbl_hosts) && !empty($rbl_hosts)) {
 				foreach ($rbl_hosts as $key => $value) {
 					$value = trim($value);
 					if($value != '') $new_options[] = "reject_rbl_client ".$value;

--
Gitblit v1.9.1