Applying patch from [fb1ad014] fixing bug [#14]

More info can be found on [fb1ad014] and has been discussed in the mailinglist:
http://article.gmane.org/gmane.network.dns.ddclient.user/71.  The patch was
send by Rodrigo Araujo.
This commit is contained in:
Wim Vinckier 2013-07-08 15:21:32 +02:00
parent 9de1d24873
commit 666cc471bc

View file

@ -1,7 +1,7 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
#!/usr/local/bin/perl -w #!/usr/local/bin/perl -w
###################################################################### ######################################################################
# $Id: ddclient 152 2013-05-14 19:10:05Z wimpunk $ # $Id: ddclient 153 2013-07-08 13:20:35Z wimpunk $
# #
# DDCLIENT - a Perl client for updating DynDNS information # DDCLIENT - a Perl client for updating DynDNS information
# #
@ -20,7 +20,7 @@ use Getopt::Long;
use Sys::Hostname; use Sys::Hostname;
use IO::Socket; use IO::Socket;
my ($VERSION) = q$Revision: 152 $ =~ /(\d+)/; my ($VERSION) = q$Revision: 153 $ =~ /(\d+)/;
my $version = "3.8.0-r". $VERSION; my $version = "3.8.0-r". $VERSION;
my $programd = $0; my $programd = $0;
@ -783,15 +783,16 @@ sub update_nics {
foreach my $h (sort keys %config) { foreach my $h (sort keys %config) {
next if $config{$h}{'protocol'} ne lc($s); next if $config{$h}{'protocol'} ne lc($s);
$examined{$h} = 1; $examined{$h} = 1;
my $use = $config{$h}{'use'} || opt('use'); # we only do this once per 'use' and argument combination
local $opt{$use} = $config{$h}{$use} if $config{$h}{$use}; my $use = opt('use', $h);
# bug #13: we should only do this once my $arg_ip = opt('ip', $h) || '';
# use isn't enough, we have to save the origin to. my $arg_fw = opt('fw', $h) || '';
# this will break the multiple ip stuff if use has my $arg_if = opt('if', $h) || '';
# been used twice for the same device. my $arg_web = opt('web', $h) || '';
my $arg_cmd = opt('cmd', $h) || '';
my $ip = ""; my $ip = "";
if (defined $iplist{$use}) { if (exists $iplist{$use}{$arg_ip}{$arg_fw}{$arg_if}{$arg_web}{$arg_cmd}) {
$ip = $iplist{$use}; $ip = $iplist{$use}{$arg_ip}{$arg_fw}{$arg_if}{$arg_web}{$arg_cmd};
} else { } else {
$ip = get_ip($use, $h); $ip = get_ip($use, $h);
if (!defined $ip || !$ip) { if (!defined $ip || !$ip) {
@ -803,7 +804,7 @@ sub update_nics {
warning("malformed IP address (%s)", $ip); warning("malformed IP address (%s)", $ip);
next; next;
} }
$iplist{$use} = $ip; $iplist{$use}{$arg_ip}{$arg_fw}{$arg_if}{$arg_web}{$arg_cmd} = $ip;
} }
$config{$h}{'wantip'} = $ip; $config{$h}{'wantip'} = $ip;
next if !nic_updateable($h, $updateable); next if !nic_updateable($h, $updateable);
@ -1943,7 +1944,7 @@ sub geturl {
sub get_ip { sub get_ip {
my $use = lc shift; my $use = lc shift;
my $h = shift; my $h = shift;
my ($ip, $arg, $reply, $url, $skip) = (undef, opt($use), ''); my ($ip, $arg, $reply, $url, $skip) = (undef, opt($use, $h), '');
$arg = '' unless $arg; $arg = '' unless $arg;
if ($use eq 'ip') { if ($use eq 'ip') {