From 71a8c22268424e074a88b7b6748e9855734b3844 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 29 Mar 2019 08:54:21 +0100 Subject: [PATCH] dns/dnydns: support googledomains wildcards, rework logic; closes #1280 Make this more readable and extensible for the future. --- dns/dyndns/Makefile | 2 +- dns/dyndns/src/www/services_dyndns_edit.php | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dns/dyndns/Makefile b/dns/dyndns/Makefile index d0fd26bc6..cd5c706f4 100644 --- a/dns/dyndns/Makefile +++ b/dns/dyndns/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= dyndns -PLUGIN_VERSION= 1.13 +PLUGIN_VERSION= 1.14 PLUGIN_COMMENT= Dynamic DNS Support PLUGIN_MAINTAINER= franco@opnsense.org diff --git a/dns/dyndns/src/www/services_dyndns_edit.php b/dns/dyndns/src/www/services_dyndns_edit.php index b1cc39111..4c10703d5 100644 --- a/dns/dyndns/src/www/services_dyndns_edit.php +++ b/dns/dyndns/src/www/services_dyndns_edit.php @@ -102,11 +102,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors); if (isset($pconfig['host']) && in_array('host', $reqdfields)) { - /* Namecheap can have a @. or *. in hostname */ - if ($pconfig['type'] == "namecheap" && (substr($pconfig['host'], 0, 2) == '@.' || substr($pconfig['host'], 0, 2) == '*.')) { - $host_to_check = substr($pconfig['host'], 2); - } else { - $host_to_check = $pconfig['host']; + $host_to_check = $pconfig['host']; + + switch ($pconfig['type']) { + case 'googledomains': + case 'namecheap': + $host_to_check = preg_replace('/^[@*]\./', '', $host_to_check); + break; + default: + break; } if (!is_domain($host_to_check)) {