dns/dyndns: update to 1.9

This commit is contained in:
Franco Fichtner 2018-09-15 11:55:59 +02:00
parent bb199fa2c8
commit c622ab61d3
4 changed files with 43 additions and 43 deletions

View file

@ -1,5 +1,5 @@
PLUGIN_NAME= dyndns
PLUGIN_VERSION= 1.8
PLUGIN_VERSION= 1.9
PLUGIN_COMMENT= Dynamic DNS Support
PLUGIN_MAINTAINER= franco@opnsense.org

View file

@ -354,7 +354,7 @@ class updatedns
curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_INTERFACE, $this->_dnsRequestIfIP);
curl_setopt($ch, CURLOPT_TIMEOUT, 120); // Completely empirical
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
}
switch ($this->_dnsService) {
@ -521,7 +521,7 @@ class updatedns
curl_setopt($ch, CURLOPT_URL, 'https://freedns.afraid.org/dynamic/update.php?' . $this->_dnsPass);
break;
case 'dnsexit':
curl_setopt($ch, CURLOPT_URL, 'https://www.dnsexit.com/RemoteUpdate.sv?login='.$this->_dnsUser. '&password='.$this->_dnsPass.'&host='.$this->_dnsHost.'&myip='.$this->_dnsIP);
curl_setopt($ch, CURLOPT_URL, 'https://www.dnsexit.com/RemoteUpdate.sv?login='.urlencode($this->_dnsUser). '&password='.$this->_dnsPass.'&host='.$this->_dnsHost.'&myip='.$this->_dnsIP);
break;
case 'loopia':
$this->_dnsWildcard = (isset($this->_dnsWildcard) && $this->_dnsWildcard == true) ? 'ON' : 'OFF';
@ -547,7 +547,7 @@ class updatedns
break;
case 'staticcling':
curl_setopt($ch, CURLOPT_URL, 'https://www.staticcling.org/update.html?login='.$this->_dnsUser.'&pass='.$this->_dnsPass);
curl_setopt($ch, CURLOPT_URL, 'https://www.staticcling.org/update.html?login='.urlencode($this->_dnsUser).'&pass='.$this->_dnsPass);
break;
case 'dnsomatic':
/* Example syntax
@ -757,7 +757,7 @@ class updatedns
$server = "https://ssl.gratisdns.dk/ddns.phtml";
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
list($hostname, $domain) = explode(".", $this->_dnsHost, 2);
curl_setopt($ch, CURLOPT_URL, $server . '?u=' . $this->_dnsUser . '&p=' . $this->_dnsPass . '&h=' . $this->_dnsHost . '&d=' . $domain);
curl_setopt($ch, CURLOPT_URL, $server . '?u=' . urlencode($this->_dnsUser) . '&p=' . $this->_dnsPass . '&h=' . $this->_dnsHost . '&d=' . $domain);
break;
case 'ovh-dynhost':
if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") {
@ -791,7 +791,7 @@ class updatedns
case 'duckdns':
$server = "https://www.duckdns.org/update";
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_URL, $server . '?domains=' . str_replace('.duckdns.org', '', $this->_dnsHost) . '&token=' . $this->_dnsUser);
curl_setopt($ch, CURLOPT_URL, $server . '?domains=' . str_replace('.duckdns.org', '', $this->_dnsHost) . '&token=' . urlencode($this->_dnsUser));
break;
case 'googledomains':
$server = "https://domains.google.com/nic/update";
@ -826,7 +826,7 @@ class updatedns
case 'regfish':
case 'regfish-v6':
$family = $this->_useIPv6 ? 'ipv6' : 'ipv4';
$server = "https://dyndns.regfish.de/?fqdn={$this->_dnsHost}&{$family}={$this->_dnsIP}&forcehost=1&token={$this->_dnsUser}";
$server = "https://dyndns.regfish.de/?fqdn={$this->_dnsHost}&{$family}={$this->_dnsIP}&forcehost=1&token=" . urlencode($this->_dnsUser);
curl_setopt($ch, CURLOPT_URL, $server);
break;
default:
@ -1125,7 +1125,7 @@ class updatedns
} elseif ($output->errors[0]->code === 9103) {
$status = "Dynamic DNS ({$this->_dnsHost}): ERROR - Invalid Credentials! Don't forget to use API Key for password field with CloudFlare.";
} elseif (($output->success) && (!$output->result[0]->id)) {
$status = "Dynamic DNS ({$this->_dnsHost}): ERROR - Zone or Host ID was not found, check your hostname.";
$status = "Dynamic DNS ({$this->_dnsHost}): ERROR - Zone or Host ID was not found, check that your hostname is correct and an A record already exists.";
} else {
$status = "Dynamic DNS ({$this->_dnsHost}): UNKNOWN ERROR - {$output->errors[0]->message}";
log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}");

View file

@ -38,7 +38,7 @@ function is_dyndns_username($uname)
{
if (!is_string($uname)) {
return false;
} elseif (preg_match("/[^a-z0-9\-.@_:]/i", $uname)) {
} elseif (preg_match("/[^a-z0-9\-.@_:+]/i", $uname)) {
return false;
} else {
return true;

View file

@ -1,32 +1,32 @@
<?php
/*
Copyright (C) 2014-2016 Deciso B.V.
Copyright (C) 2008 Ermal Luçi
Copyright (C) 2013 Stanley P. Miller \ stan-qaz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INClUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
* Copyright (C) 2014-2016 Deciso B.V.
* Copyright (C) 2008 Ermal Luçi
* Copyright (C) 2013 Stanley P. Miller \ stan-qaz
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INClUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
require_once("guiconfig.inc");
require_once("widgets/include/dyn_dns_status.inc");
@ -88,10 +88,10 @@ if (!empty($_REQUEST['getdyndnsstatus'])) {
<table class="table table-striped table-condensed">
<thead>
<tr>
<th><?=gettext("Interface");?></th>
<th><?=gettext("Service");?></th>
<th><?=gettext("Hostname");?></th>
<th><?=gettext("Cached IP");?></th>
<th style="word-break:break-word;"><?=gettext("Interface");?></th>
<th style="word-break:break-word;"><?=gettext("Service");?></th>
<th style="word-break:break-word;"><?=gettext("Hostname");?></th>
<th style="word-break:break-word;"><?=gettext("Cached IP");?></th>
</tr>
</thead>
<tbody>
@ -101,7 +101,7 @@ if (!empty($_REQUEST['getdyndnsstatus'])) {
$groupslist = return_gateway_groups_array();
foreach ($a_dyndns as $i => $dyndns) :?>
<tr ondblclick="document.location='services_dyndns_edit.php?id=<?=$i;?>'">
<td <?= isset($dyndns['enable']) ? '' : 'class="text-muted"' ?>>
<td style="word-break:break-word;" <?= isset($dyndns['enable']) ? '' : 'class="text-muted"' ?>>
<?php
foreach ($iflist as $if => $ifdesc) {
if ($dyndns['interface'] == $if) {
@ -116,7 +116,7 @@ if (!empty($_REQUEST['getdyndnsstatus'])) {
}
}?>
</td>
<td <?= isset($dyndns['enable']) ? '' : 'class="text-muted"' ?>>
<td style="word-break:break-word;" <?= isset($dyndns['enable']) ? '' : 'class="text-muted"' ?>>
<?php
if (isset($types[$dyndns['type']])) {
echo htmlspecialchars($types[$dyndns['type']]);
@ -125,10 +125,10 @@ if (!empty($_REQUEST['getdyndnsstatus'])) {
}
?>
</td>
<td <?= isset($dyndns['enable']) ? '' : 'class="text-muted"' ?>>
<td style="word-break:break-word;" <?= isset($dyndns['enable']) ? '' : 'class="text-muted"' ?>>
<?= htmlspecialchars($dyndns['host']) ?>
</td>
<td <?= isset($dyndns['enable']) ? '' : 'class="text-muted"' ?>>
<td style="word-break:break-word;" <?= isset($dyndns['enable']) ? '' : 'class="text-muted"' ?>>
<div id='dyndnsstatus<?=$i;?>'>
<?= gettext('Checking...') ?>
</div>