dns/dnydns: support googledomains wildcards, rework logic; closes #1280

Make this more readable and extensible for the future.
This commit is contained in:
Franco Fichtner
2019-03-29 08:54:55 +01:00
parent 6527e3436e
commit 71a8c22268
2 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -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
+9 -5
View File
@@ -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)) {