commit
48daf8a5d7
1 changed files with 18 additions and 13 deletions
31
ddclient.in
31
ddclient.in
|
@ -1226,8 +1226,7 @@ sub main {
|
||||||
$SIG{'CHLD'} = 'IGNORE';
|
$SIG{'CHLD'} = 'IGNORE';
|
||||||
my $pid = fork;
|
my $pid = fork;
|
||||||
if ($pid < 0) {
|
if ($pid < 0) {
|
||||||
print STDERR "${program}: can not fork ($!)\n";
|
fatal("failed to fork: %s", $!);
|
||||||
exit -1;
|
|
||||||
} elsif ($pid) {
|
} elsif ($pid) {
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
@ -1665,6 +1664,7 @@ sub _read_config {
|
||||||
local *FD;
|
local *FD;
|
||||||
if (!open(FD, "< $file")) {
|
if (!open(FD, "< $file")) {
|
||||||
warning("Cannot open file '%s'. (%s)", $file, $!);
|
warning("Cannot open file '%s'. (%s)", $file, $!);
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
# If file is owned by our effective uid, ensure that it has no access for group or others.
|
# If file is owned by our effective uid, ensure that it has no access for group or others.
|
||||||
|
@ -1810,6 +1810,7 @@ sub _read_config {
|
||||||
warning("file ends while expecting a continuation line.")
|
warning("file ends while expecting a continuation line.")
|
||||||
if $continuation;
|
if $continuation;
|
||||||
|
|
||||||
|
done:
|
||||||
%$globals = %globals;
|
%$globals = %globals;
|
||||||
%$config = %config;
|
%$config = %config;
|
||||||
|
|
||||||
|
@ -2274,17 +2275,17 @@ sub pipecmd {
|
||||||
## execute the command.
|
## execute the command.
|
||||||
local *FD;
|
local *FD;
|
||||||
if (!open(FD, $cmd)) {
|
if (!open(FD, $cmd)) {
|
||||||
printf STDERR "%s: cannot execute command %s.\n", $program, $cmd;
|
warning('cannot execute command %s.', $cmd);
|
||||||
|
|
||||||
} elsif ($stdin && (!print FD "$stdin\n")) {
|
} elsif ($stdin && (!print FD "$stdin\n")) {
|
||||||
printf STDERR "%s: failed writting to %s.\n", $program, $cmd;
|
warning('failed writting to %s.', $cmd);
|
||||||
close(FD);
|
close(FD);
|
||||||
|
|
||||||
} elsif (!close(FD)) {
|
} elsif (!close(FD)) {
|
||||||
printf STDERR "%s: failed closing %s.(%s)\n", $program, $cmd, $@;
|
warning('failed closing %s. (%s)', $cmd, $@);
|
||||||
|
|
||||||
} elsif (opt('exec') && $?) {
|
} elsif (opt('exec') && $?) {
|
||||||
printf STDERR "%s: failed %s. (%s)\n", $program, $cmd, $@;
|
warning('failed %s. (%s)', $cmd, $@);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$ok = 1;
|
$ok = 1;
|
||||||
|
@ -2391,6 +2392,7 @@ sub ynu {
|
||||||
## warning
|
## warning
|
||||||
## fatal
|
## fatal
|
||||||
######################################################################
|
######################################################################
|
||||||
|
my $_in_msg = 0;
|
||||||
sub _msg {
|
sub _msg {
|
||||||
my $fh = shift;
|
my $fh = shift;
|
||||||
my $log = shift;
|
my $log = shift;
|
||||||
|
@ -2413,7 +2415,11 @@ sub _msg {
|
||||||
print $fh $buffer;
|
print $fh $buffer;
|
||||||
|
|
||||||
$msgs .= $buffer if $log;
|
$msgs .= $buffer if $log;
|
||||||
logger($buffer) if $log;
|
if ($log && !$_in_msg) {
|
||||||
|
++$_in_msg; # avoid infinite recursion if logger calls _msg
|
||||||
|
logger($buffer);
|
||||||
|
--$_in_msg;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
sub msg { _msg(*STDOUT, 0, '', @_); }
|
sub msg { _msg(*STDOUT, 0, '', @_); }
|
||||||
|
@ -5205,7 +5211,7 @@ sub nic_nfsn_update {
|
||||||
|
|
||||||
my $ip = delete $config{$h}{'wantip'};
|
my $ip = delete $config{$h}{'wantip'};
|
||||||
info("setting IP address to %s for %s", $ip, $h);
|
info("setting IP address to %s for %s", $ip, $h);
|
||||||
verbose("UPDATE", "updating %s", $h);
|
verbose("UPDATE:", "updating %s", $h);
|
||||||
|
|
||||||
my $list_path = "/dns/$zone/listRRs";
|
my $list_path = "/dns/$zone/listRRs";
|
||||||
my $list_body = encode_www_form_urlencoded({name => $name, type => 'A'});
|
my $list_body = encode_www_form_urlencoded({name => $name, type => 'A'});
|
||||||
|
@ -5843,7 +5849,7 @@ sub nic_godaddy_update {
|
||||||
|
|
||||||
failed("%s.%s -- Unexpected or empty service response, cannot parse data.", $hostname, $zone);
|
failed("%s.%s -- Unexpected or empty service response, cannot parse data.", $hostname, $zone);
|
||||||
} elsif (defined($response->{code})) {
|
} elsif (defined($response->{code})) {
|
||||||
verbose("VERBOSE:", "%s.%s -- %s - %s.", $hostname, $zone, $response->{code}, $response->{message});
|
info("%s.%s -- %s - %s.", $hostname, $zone, $response->{code}, $response->{message});
|
||||||
}
|
}
|
||||||
if ($ok) {
|
if ($ok) {
|
||||||
# read data
|
# read data
|
||||||
|
@ -7287,7 +7293,7 @@ sub nic_porkbun_update {
|
||||||
# Default to the subdomain/domain being split at the first dot
|
# Default to the subdomain/domain being split at the first dot
|
||||||
($sub_domain, $domain) = split(/\./, $host, 2);
|
($sub_domain, $domain) = split(/\./, $host, 2);
|
||||||
}
|
}
|
||||||
verbose("VERBOSE:", "subdomain %s, root domain %s", $sub_domain, $domain) if $sub_domain ne '';
|
info("subdomain %s, root domain %s", $sub_domain, $domain) if $sub_domain ne '';
|
||||||
|
|
||||||
foreach my $ipv ('ipv4', 'ipv6') {
|
foreach my $ipv ('ipv4', 'ipv6') {
|
||||||
my $ip = delete $config{$host}{"want$ipv"};
|
my $ip = delete $config{$host}{"want$ipv"};
|
||||||
|
@ -8061,8 +8067,7 @@ sub nic_infomaniak_update {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
verbose("VERBOSE:", "setting IP address to %s for %s", $ip, $h);
|
info("setting IP address to %s for %s", $ip, $h);
|
||||||
info("updating %s", $h);
|
|
||||||
|
|
||||||
# No change in IP => nochg <w.x.y.z>
|
# No change in IP => nochg <w.x.y.z>
|
||||||
# Bad auth => badauth
|
# Bad auth => badauth
|
||||||
|
@ -8091,7 +8096,7 @@ sub nic_infomaniak_update {
|
||||||
my $reply;
|
my $reply;
|
||||||
|
|
||||||
foreach my $url ($url1, $url2) {
|
foreach my $url ($url1, $url2) {
|
||||||
verbose("VERBOSE:", "trying update with %s", $url);
|
info("trying update with %s", $url);
|
||||||
$reply = geturl(proxy => opt('proxy'), url => $url);
|
$reply = geturl(proxy => opt('proxy'), url => $url);
|
||||||
if (!defined($reply) || !$reply) {
|
if (!defined($reply) || !$reply) {
|
||||||
info("could not update %s using url %s, trying next one", $h, $url);
|
info("could not update %s using url %s, trying next one", $h, $url);
|
||||||
|
|
Loading…
Reference in a new issue