Fixing warnings on FreeDNS update NOP

Fix based on pull request #31 on github commited by @hank.
_original comments_
When FreeDNS was updating, I was noticing that it would send back an HTTP 200
with the text "Address [IP] has not changed", but ddclient was issuing a
failed status for this and logging a ton of text to syslog. I changed the
function a tiny bit to allow this to be a success status. I also reformatted
the code to all spaces instead of mixed spaces and tabs, but you can take that
or leave it - I don't really care, it was just a total whitespace disaster
before.
This commit is contained in:
wimpunk 2015-12-03 21:27:41 +01:00
parent 4f7fb1b3aa
commit 5abb9fe1fe

View file

@ -3704,10 +3704,7 @@ EoEXAMPLE
## ##
###################################################################### ######################################################################
sub nic_freedns_update { sub nic_freedns_update {
debug("\nnic_freedns_update -------------------"); debug("\nnic_freedns_update -------------------");
## First get the list of updatable hosts ## First get the list of updatable hosts
my $url; my $url;
$url = "http://$config{$_[0]}{'server'}/api/?action=getdyndns&sha=".&sha1_hex("$config{$_[0]}{'login'}|$config{$_[0]}{'password'}"); $url = "http://$config{$_[0]}{'server'}/api/?action=getdyndns&sha=".&sha1_hex("$config{$_[0]}{'login'}|$config{$_[0]}{'password'}");
@ -3749,11 +3746,17 @@ sub nic_freedns_update {
last; last;
} }
if($reply =~ /Updated.*$h.*to.*$ip/) { if ($reply =~ /Updated.*$h.*to.*$ip/) {
$config{$h}{'ip'} = $ip; $config{$h}{'ip'} = $ip;
$config{$h}{'mtime'} = $now; $config{$h}{'mtime'} = $now;
$config{$h}{'status'} = 'good'; $config{$h}{'status'} = 'good';
success("updating %s: good: IP address set to %s", $h, $ip); success("updating %s: good: IP address set to %s", $h, $ip);
} elsif ($reply =~ /Address (\d+\.\d+\.\d+\.\d+) has not changed/) {
$ip = $1;
$config{$h}{'mtime'} = $now;
$config{$h}{'status'} = 'good';
$config{$h}{'ip'} = $ip;
success("updating %s: good: IP address %s has not changed", $h, $ip);
} else { } else {
$config{$h}{'status'} = 'failed'; $config{$h}{'status'} = 'failed';
warning("SENT: %s", $freedns_hosts{$h}->[2]) unless opt('verbose'); warning("SENT: %s", $freedns_hosts{$h}->[2]) unless opt('verbose');