From 07bd3f83b401d8e9e9de3938e0a26c6e452660af Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 5 Dec 2004 19:31:44 +0000 Subject: Synchornize with m0n0wall 1.2b3. These files have not really been modified too much so a straight copy works. 9 files remain to be patched by hand. --- usr/local/www/services_dyndns.php | 146 +++++++++++++++++++++++++++++++------- 1 file changed, 120 insertions(+), 26 deletions(-) (limited to 'usr/local/www/services_dyndns.php') diff --git a/usr/local/www/services_dyndns.php b/usr/local/www/services_dyndns.php index e4864e6..20cdefd 100755 --- a/usr/local/www/services_dyndns.php +++ b/usr/local/www/services_dyndns.php @@ -31,6 +31,10 @@ require("guiconfig.inc"); +if (!is_array($config['dnsupdate'])) { + $config['dnsupdate'] = array(); +} + $pconfig['username'] = $config['dyndns']['username']; $pconfig['password'] = $config['dyndns']['password']; $pconfig['host'] = $config['dyndns']['host']; @@ -39,18 +43,35 @@ $pconfig['type'] = $config['dyndns']['type']; $pconfig['enable'] = isset($config['dyndns']['enable']); $pconfig['wildcard'] = isset($config['dyndns']['wildcard']); +$pconfig['dnsupdate_enable'] = isset($config['dnsupdate']['enable']); +$pconfig['dnsupdate_host'] = $config['dnsupdate']['host']; +$pconfig['dnsupdate_ttl'] = $config['dnsupdate']['ttl']; +if (!$pconfig['dnsupdate_ttl']) + $pconfig['dnsupdate_ttl'] = 60; +$pconfig['dnsupdate_keydata'] = $config['dnsupdate']['keydata']; +$pconfig['dnsupdate_keyname'] = $config['dnsupdate']['keyname']; +$pconfig['dnsupdate_keytype'] = $config['dnsupdate']['keytype']; +if (!$pconfig['dnsupdate_keytype']) + $pconfig['dnsupdate_keytype'] = "zone"; +$pconfig['dnsupdate_usetcp'] = isset($config['dnsupdate']['usetcp']); + if ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ + $reqdfields = array(); + $reqdfieldsn = array(); if ($_POST['enable']) { - $reqdfields = explode(" ", "host username password type"); - $reqdfieldsn = explode(",", "Hostname,Username,Password,Service type"); - - do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + $reqdfields = array_merge($reqdfields, explode(" ", "host username password type")); + $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Hostname,Username,Password,Service type")); } + if ($_POST['dnsupdate_enable']) { + $reqdfields = array_merge($reqdfields, explode(" ", "dnsupdate_host dnsupdate_ttl dnsupdate_keyname dnsupdate_keydata")); + $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Hostname,TTL,Key name,Key")); + } + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); if (($_POST['host'] && !is_domain($_POST['host']))) { $input_errors[] = "The host name contains invalid characters."; @@ -61,6 +82,16 @@ if ($_POST) { if (($_POST['username'] && !is_dyndns_username($_POST['username']))) { $input_errors[] = "The username contains invalid characters."; } + + if (($_POST['dnsupdate_host'] && !is_domain($_POST['dnsupdate_host']))) { + $input_errors[] = "The DNS update host name contains invalid characters."; + } + if (($_POST['dnsupdate_ttl'] && !is_numericint($_POST['dnsupdate_ttl']))) { + $input_errors[] = "The DNS update TTL must be an integer."; + } + if (($_POST['dnsupdate_keyname'] && !is_domain($_POST['dnsupdate_keyname']))) { + $input_errors[] = "The DNS update key name contains invalid characters."; + } if (!$input_errors) { $config['dyndns']['type'] = $_POST['type']; @@ -70,6 +101,14 @@ if ($_POST) { $config['dyndns']['mx'] = $_POST['mx']; $config['dyndns']['wildcard'] = $_POST['wildcard'] ? true : false; $config['dyndns']['enable'] = $_POST['enable'] ? true : false; + + $config['dnsupdate']['enable'] = $_POST['dnsupdate_enable'] ? true : false; + $config['dnsupdate']['host'] = $_POST['dnsupdate_host']; + $config['dnsupdate']['ttl'] = $_POST['dnsupdate_ttl']; + $config['dnsupdate']['keyname'] = $_POST['dnsupdate_keyname']; + $config['dnsupdate']['keytype'] = $_POST['dnsupdate_keytype']; + $config['dnsupdate']['keydata'] = $_POST['dnsupdate_keydata']; + $config['dnsupdate']['usetcp'] = $_POST['dnsupdate_usetcp'] ? true : false; write_config(); @@ -79,6 +118,7 @@ if ($_POST) { config_lock(); services_dyndns_reset(); $retval = services_dyndns_configure(); + $retval |= services_dnsupdate_process(); config_unlock(); } $savemsg = get_std_save_message($retval); @@ -94,21 +134,25 @@ if ($_POST) { @@ -122,11 +166,12 @@ function enable_change(enable_change) {
- - - + + @@ -173,6 +218,55 @@ function enable_change(enable_change) { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + by DHCP/PPP on WAN for dynamic DNS updates to work.
  - onClick="enable_change(false)"> - Enable Dynamic DNS client
+ + + +
Dynamic DNS client onClick="enable_change(false)"> Enable
Service type @@ -157,7 +202,7 @@ function enable_change(enable_change) {
Wildcards - > + > Enable Wildcard
+ + + +
RFC 2163 Dynamic DNS updates onClick="enable_change(false)"> Enable
Hostname + +
TTL + + seconds
Key name + +
+ This must match the setting on the DNS server.
Key type + > Zone   + > Host   + > User +
Key + +
+ Paste an HMAC-MD5 key here.
Protocol + > + Use TCP instead of UDP
  @@ -183,7 +277,7 @@ function enable_change(enable_change) { Note:
You must configure a DNS server in System: General setup or allow the DNS server list to be overridden - by DHCP/PPP on WAN for the DynDNS client to work.
-- cgit v1.1