#!/usr/local/bin/php . 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. */ $pgtitle = array("Services", "Dynamic DNS"); 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']; $pconfig['server'] = $config['dyndns']['server']; $pconfig['port'] = $config['dyndns']['port']; $pconfig['mx'] = $config['dyndns']['mx']; $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_usetcp'] = isset($config['dnsupdate']['usetcp']); if ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ $reqdfields = array(); $reqdfieldsn = array(); if ($_POST['enable']) { $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."; } if (($_POST['server'] && !is_domain($_POST['server']) && !is_ipaddr($_POST['server']))) { $input_errors[] = "The server name contains invalid characters."; } if (($_POST['port'] && !is_port($_POST['port']))) { $input_errors[] = "The server port must be an integer between 1 and 65535."; } if (($_POST['mx'] && !is_domain($_POST['mx']))) { $input_errors[] = "The MX contains invalid characters."; } 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']; $config['dyndns']['username'] = $_POST['username']; $config['dyndns']['password'] = $_POST['password']; $config['dyndns']['host'] = $_POST['host']; $config['dyndns']['server'] = $_POST['server']; $config['dyndns']['port'] = $_POST['port']; $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']['keydata'] = $_POST['dnsupdate_keydata']; $config['dnsupdate']['usetcp'] = $_POST['dnsupdate_usetcp'] ? true : false; write_config(); $retval = 0; if (!file_exists($d_sysrebootreqd_path)) { /* nuke the cache file */ config_lock(); services_dyndns_reset(); $retval = services_dyndns_configure(); $retval |= services_dnsupdate_process(); config_unlock(); } $savemsg = get_std_save_message($retval); } } ?>