From 1ccff148d87b2194b74f479ec686ae58016be0c3 Mon Sep 17 00:00:00 2001
From: thom <thom@amsterdamtech.nl>
Date: Tue, 15 Sep 2020 13:04:07 +0200
Subject: [PATCH] Convert @ and * to full hostname (#5558 and #5463)

---
 interface/web/dns/dns_edit_base.php | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/interface/web/dns/dns_edit_base.php b/interface/web/dns/dns_edit_base.php
index 4f61b71ce5..e2e504bff5 100644
--- a/interface/web/dns/dns_edit_base.php
+++ b/interface/web/dns/dns_edit_base.php
@@ -112,7 +112,17 @@ class dns_page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
+
+		//* Replace @ to domain name
+		if(stristr($this->dataRecord["name"], '@')) {
+			$this->dataRecord["name"] = str_replace('@', $soa['origin'], $this->dataRecord["name"]);
+		}
+
+		//* Replace * to *.example.com.
+		if(stristr($this->dataRecord["name"], '*')) {
+			$this->dataRecord["name"] = str_replace('*', '*.' . $soa['origin'], $this->dataRecord["name"]);
+		}
+
 		if($this->checkDuplicate()) $app->tform->errorMessage .= $app->tform->lng("data_error_duplicate")."<br>";
 
 		// Set the server ID of the rr record to the same server ID as the parent record.
-- 
GitLab