From f3b2b2a42c3bcda93f01bdcfc2264df51bb0c7a2 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 22 Feb 2012 20:02:09 -0500 Subject: [PATCH] Fixing existing DynDNS force-update feature. Redmine bug #2228 --- etc/inc/dyndns.class | 4 ++-- etc/inc/services.inc | 8 ++++++-- usr/local/www/services_dyndns.php | 3 ++- usr/local/www/services_dyndns_edit.php | 12 +++--------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class index 5c853a9e9f..beb3633a99 100644 --- a/etc/inc/dyndns.class +++ b/etc/inc/dyndns.class @@ -94,7 +94,7 @@ */ function updatedns ($dnsService = '', $dnsHost = '', $dnsUser = '', $dnsPass = '', $dnsWildcard = 'OFF', $dnsMX = '', $dnsIf = '', $dnsBackMX = '', - $dnsServer = '', $dnsPort = '', $dnsUpdateURL = '') { + $dnsServer = '', $dnsPort = '', $dnsUpdateURL = '', $forceUpdate = false) { global $config, $g; @@ -140,7 +140,7 @@ $this->_debugID = rand(1000000, 9999999); - if ($this->_detectChange() == false) { + if ($forceUpdate == false && $this->_detectChange() == false) { $this->_error(10); } else { switch ($this->_dnsService) { diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 2af9aa9f18..66931612d1 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -1309,8 +1309,12 @@ function services_dyndns_configure_client($conf) { $dnsPass = $conf['password'], $dnsWilcard = $conf['wildcard'], $dnsMX = $conf['mx'], - $dnsIf = "{$conf['interface']}"); - + $dnsIf = "{$conf['interface']}", + $dnsBackMX = NULL, + $dnsServer = NULL, + $dnsPort = NULL, + $dnsUpdateURL = NULL, + $forceUpdate = $conf['force']); } function services_dyndns_configure($int = "") { diff --git a/usr/local/www/services_dyndns.php b/usr/local/www/services_dyndns.php index 9b359f4658..950733b74e 100755 --- a/usr/local/www/services_dyndns.php +++ b/usr/local/www/services_dyndns.php @@ -159,7 +159,8 @@ include("head.inc");


- +
+   diff --git a/usr/local/www/services_dyndns_edit.php b/usr/local/www/services_dyndns_edit.php index 136d65471e..f09b9f6c52 100644 --- a/usr/local/www/services_dyndns_edit.php +++ b/usr/local/www/services_dyndns_edit.php @@ -104,6 +104,7 @@ if ($_POST) { $dyndns['enable'] = $_POST['enable'] ? false : true; $dyndns['interface'] = $_POST['interface']; $dyndns['descr'] = $_POST['descr']; + $dyndns['force'] = isset($_POST['force']); if($dyndns['username'] == "none") $dyndns['username'] = ""; @@ -115,15 +116,7 @@ if ($_POST) { write_config(); - $retval = 0; - - conf_mount_rw(); - - unlink("{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}{$dyndns['host']}.cache"); - - $retval = services_dyndns_configure_client($dyndns); - - conf_mount_ro(); + services_dyndns_configure_client($dyndns); header("Location: services_dyndns.php"); exit; @@ -237,6 +230,7 @@ include("head.inc"); "> + " onClick="enable_change(true)">