CloudFlare will shutdown the old v1 API on June 4, 2018. ddclient on the repository already supports the current v4 API, but there is no newer release since 2015. Also includes CloudFlare IPv6 support. PR: 228600 Submitted by: maintainer
85 lines
2.7 KiB
Text
85 lines
2.7 KiB
Text
--- ddclient.orig 2018-05-23 10:25:05 UTC
|
|
+++ ddclient
|
|
@@ -25,6 +25,7 @@ use Getopt::Long;
|
|
use Sys::Hostname;
|
|
use IO::Socket;
|
|
use Data::Validate::IP;
|
|
+use POSIX 'setsid';
|
|
|
|
my $version = "3.8.3";
|
|
my $programd = $0;
|
|
@@ -33,9 +34,9 @@ my $program = $programd;
|
|
$program =~ s/d$//;
|
|
my $now = time;
|
|
my $hostname = hostname();
|
|
-my $etc = ($program =~ /test/i) ? './' : '/etc/ddclient/';
|
|
-my $cachedir = ($program =~ /test/i) ? './' : '/var/cache/ddclient/';
|
|
-my $savedir = ($program =~ /test/i) ? 'URL/' : '/tmp/';
|
|
+my $etc = ($program =~ /test/i) ? './' : '%%ETCDIR%%/';
|
|
+my $cachedir = ($program =~ /test/i) ? './' : '/var/tmp/';
|
|
+my $savedir = ($program =~ /test/i) ? 'URL/' : '/var/tmp/';
|
|
my $msgs = '';
|
|
my $last_msgs = '';
|
|
|
|
@@ -43,7 +44,7 @@ use vars qw($file $lineno);
|
|
local $file = '';
|
|
local $lineno = '';
|
|
|
|
-$ENV{'PATH'} = (exists($ENV{PATH}) ? "$ENV{PATH}:" : "") . "/sbin:/usr/sbin:/bin:/usr/bin:/etc:/usr/lib:";
|
|
+$ENV{'PATH'} = (exists($ENV{PATH}) ? "$ENV{PATH}:" : "") . "/sbin:/usr/sbin:/bin:";
|
|
|
|
sub T_ANY {'any'};
|
|
sub T_STRING {'string'};
|
|
@@ -792,6 +793,9 @@ if (opt('foreground') || opt('force')) {
|
|
;
|
|
} elsif (opt('daemon')) {
|
|
$SIG{'CHLD'} = 'IGNORE';
|
|
+ chdir '/';
|
|
+ open(STDIN, "</dev/null");
|
|
+ open(STDOUT, ">/dev/null");
|
|
my $pid = fork;
|
|
if ($pid < 0) {
|
|
print STDERR "${program}: can not fork ($!)\n";
|
|
@@ -799,10 +803,9 @@ if (opt('foreground') || opt('force')) {
|
|
} elsif ($pid) {
|
|
exit 0;
|
|
}
|
|
+ setsid;
|
|
$SIG{'CHLD'} = 'DEFAULT';
|
|
- open(STDOUT, ">/dev/null");
|
|
- open(STDERR, ">/dev/null");
|
|
- open(STDIN, "</dev/null");
|
|
+ open(STDERR, "&STDOUT");
|
|
}
|
|
|
|
# write out the pid file if we're daemon'ized
|
|
@@ -1595,17 +1598,17 @@ sub pipecmd {
|
|
## execute the command.
|
|
local *FD;
|
|
if (! open(FD, $cmd)) {
|
|
- printf STDERR "$program: cannot execute command %s.\n", $cmd;
|
|
+ warning("$program: cannot execute command %s.\n", $cmd);
|
|
|
|
} elsif ($stdin && (! print FD "$stdin\n")) {
|
|
- printf STDERR "$program: failed writting to %s.\n", $cmd;
|
|
+ warning("$program: failed writing to %s.\n", $cmd);
|
|
close(FD);
|
|
|
|
} elsif (! close(FD)) {
|
|
- printf STDERR "$program: failed closing %s.($@)\n", $cmd;
|
|
+ warning("$program: failed closing %s.($@)\n", $cmd);
|
|
|
|
} elsif (opt('exec') && $?) {
|
|
- printf STDERR "$program: failed %s. ($@)\n", $cmd;
|
|
+ warning("$program: failed %s. ($@)\n", $cmd);
|
|
|
|
} else {
|
|
$ok = 1;
|
|
@@ -2034,6 +2037,7 @@ sub geturl {
|
|
$sd = IO::Socket::SSL->new(
|
|
PeerAddr => $peer,
|
|
PeerPort => $port,
|
|
+ SSL_ca_file => '%%LOCALBASE%%/share/certs/ca-root-nss.crt',
|
|
Proto => 'tcp',
|
|
MultiHomed => 1,
|
|
Timeout => opt('timeout'),
|