From c757eec4417aab69d2733916cc769c23b62a1fc7 Mon Sep 17 00:00:00 2001
From: Jesse Norell <jesse@kci.net>
Date: Wed, 3 Feb 2016 17:32:41 -0700
Subject: [PATCH] myhostname placeholder needs to be regex

---
 install/lib/installer_base.lib.php | 8 +++++---
 install/tpl/helo_access.master     | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 431fea4742..503aa0b800 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -896,6 +896,8 @@ class installer_base {
 		}
 		unset($server_ini_array);
 		
+		$tmp = str_replace('.','\.',$conf['hostname']);
+
 		$postconf_placeholders = array('{config_dir}' => $config_dir,
 			'{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
 			'{vmail_userid}' => $cf['vmail_userid'],
@@ -903,7 +905,7 @@ class installer_base {
 			'{rbl_list}' => $rbl_list,
 			'{greylisting}' => $greylisting,
 			'{reject_slm}' => $reject_sender_login_mismatch,
-			'{myhostname}' => $conf['hostname'],
+			'{myhostname}' => $tmp,
 		);
 
 		$postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_postfix.conf.master', 'tpl/debian_postfix.conf.master');
@@ -938,8 +940,8 @@ class installer_base {
 		$configfile = 'helo_access';
 		if(is_file($config_dir.'/'.$configfile)) {
 			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
+			chmod($config_dir.'/'.$configfile.'~', 0400);
 		}
-		chmod($config_dir.'/'.$configfile.'~', 0400);
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = strtr($content, $postconf_placeholders);
 		# todo: look up this server's ip addrs and loop through each
@@ -949,8 +951,8 @@ class installer_base {
 		$configfile = 'blacklist_helo';
 		if(is_file($config_dir.'/'.$configfile)) {
 			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
+			chmod($config_dir.'/'.$configfile.'~', 0400);
 		}
-		chmod($config_dir.'/'.$configfile.'~', 0400);
 		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = strtr($content, $postconf_placeholders);
 		wf($config_dir.'/'.$configfile, $content);
diff --git a/install/tpl/helo_access.master b/install/tpl/helo_access.master
index 15169afd7d..796c3ed52a 100644
--- a/install/tpl/helo_access.master
+++ b/install/tpl/helo_access.master
@@ -2,7 +2,7 @@
 # be sure to list your own hostname(s), domain(s) and IP address(es) here
 
 # Reject others identifying with this machine's hostnames and IP addresses
-{myhostname}  REJECT
+/^{myhostname}$/  REJECT
 #/^((smtp|mx|mail)\.domain1\.com$/	REJECT
 #/^mail\.domain2\.com$/		REJECT
 
-- 
GitLab