Lines 1-14
Link Here
|
1 |
--- ddclient.orig 2015-05-30 21:37:38.000000000 +1200 |
1 |
--- ddclient.orig 2018-05-23 10:25:05 UTC |
2 |
+++ ddclient 2017-02-08 11:00:23.812579000 +1300 |
2 |
+++ ddclient |
3 |
@@ -25,6 +25,7 @@ |
3 |
@@ -25,6 +25,7 @@ use Getopt::Long; |
4 |
use Getopt::Long; |
|
|
5 |
use Sys::Hostname; |
4 |
use Sys::Hostname; |
6 |
use IO::Socket; |
5 |
use IO::Socket; |
|
|
6 |
use Data::Validate::IP; |
7 |
+use POSIX 'setsid'; |
7 |
+use POSIX 'setsid'; |
8 |
|
8 |
|
9 |
# my ($VERSION) = q$Revision: 184 $ =~ /(\d+)/; |
9 |
my $version = "3.8.3"; |
10 |
|
10 |
my $programd = $0; |
11 |
@@ -35,9 +36,9 @@ |
11 |
@@ -33,9 +34,9 @@ my $program = $programd; |
12 |
$program =~ s/d$//; |
12 |
$program =~ s/d$//; |
13 |
my $now = time; |
13 |
my $now = time; |
14 |
my $hostname = hostname(); |
14 |
my $hostname = hostname(); |
Lines 21-27
Link Here
|
21 |
my $msgs = ''; |
21 |
my $msgs = ''; |
22 |
my $last_msgs = ''; |
22 |
my $last_msgs = ''; |
23 |
|
23 |
|
24 |
@@ -45,7 +46,7 @@ |
24 |
@@ -43,7 +44,7 @@ use vars qw($file $lineno); |
25 |
local $file = ''; |
25 |
local $file = ''; |
26 |
local $lineno = ''; |
26 |
local $lineno = ''; |
27 |
|
27 |
|
Lines 30-36
Link Here
|
30 |
|
30 |
|
31 |
sub T_ANY {'any'}; |
31 |
sub T_ANY {'any'}; |
32 |
sub T_STRING {'string'}; |
32 |
sub T_STRING {'string'}; |
33 |
@@ -743,6 +744,9 @@ |
33 |
@@ -792,6 +793,9 @@ if (opt('foreground') || opt('force')) { |
34 |
; |
34 |
; |
35 |
} elsif (opt('daemon')) { |
35 |
} elsif (opt('daemon')) { |
36 |
$SIG{'CHLD'} = 'IGNORE'; |
36 |
$SIG{'CHLD'} = 'IGNORE'; |
Lines 40-46
Link Here
|
40 |
my $pid = fork; |
40 |
my $pid = fork; |
41 |
if ($pid < 0) { |
41 |
if ($pid < 0) { |
42 |
print STDERR "${program}: can not fork ($!)\n"; |
42 |
print STDERR "${program}: can not fork ($!)\n"; |
43 |
@@ -750,10 +754,9 @@ |
43 |
@@ -799,10 +803,9 @@ if (opt('foreground') || opt('force')) { |
44 |
} elsif ($pid) { |
44 |
} elsif ($pid) { |
45 |
exit 0; |
45 |
exit 0; |
46 |
} |
46 |
} |
Lines 53-59
Link Here
|
53 |
} |
53 |
} |
54 |
|
54 |
|
55 |
# write out the pid file if we're daemon'ized |
55 |
# write out the pid file if we're daemon'ized |
56 |
@@ -1544,17 +1547,17 @@ |
56 |
@@ -1595,17 +1598,17 @@ sub pipecmd { |
57 |
## execute the command. |
57 |
## execute the command. |
58 |
local *FD; |
58 |
local *FD; |
59 |
if (! open(FD, $cmd)) { |
59 |
if (! open(FD, $cmd)) { |
Lines 75-98
Link Here
|
75 |
|
75 |
|
76 |
} else { |
76 |
} else { |
77 |
$ok = 1; |
77 |
$ok = 1; |
78 |
@@ -1878,13 +1881,13 @@ |
78 |
@@ -2034,6 +2037,7 @@ sub geturl { |
79 |
## load_json_support |
|
|
80 |
###################################################################### |
81 |
sub load_json_support { |
82 |
- my $json_loaded = eval {require JSON::Any}; |
83 |
+ my $json_loaded = eval {require JSON::PP}; |
84 |
unless ($json_loaded) { |
85 |
fatal(<<"EOM"); |
86 |
-Error loading the Perl module JSON::Any needed for cloudflare update. |
87 |
+Error loading the Perl module JSON::PP needed for cloudflare update. |
88 |
EOM |
89 |
} |
90 |
- import JSON::Any; |
91 |
+ import JSON::PP (qw/decode_json/); |
92 |
} |
93 |
###################################################################### |
94 |
## geturl |
95 |
@@ -1957,6 +1960,7 @@ |
96 |
$sd = IO::Socket::SSL->new( |
79 |
$sd = IO::Socket::SSL->new( |
97 |
PeerAddr => $peer, |
80 |
PeerAddr => $peer, |
98 |
PeerPort => $port, |
81 |
PeerPort => $port, |
Lines 100-128
Link Here
|
100 |
Proto => 'tcp', |
83 |
Proto => 'tcp', |
101 |
MultiHomed => 1, |
84 |
MultiHomed => 1, |
102 |
Timeout => opt('timeout'), |
85 |
Timeout => opt('timeout'), |
103 |
@@ -4096,9 +4100,9 @@ |
|
|
104 |
|
105 |
# Strip header |
106 |
$reply =~ s/^.*?\n\n//s; |
107 |
- my $response = JSON::Any->jsonToObj($reply); |
108 |
- if ($response->{result} eq 'error') { |
109 |
- failed ("%s", $response->{msg}); |
110 |
+ my $response = eval {decode_json($reply)}; |
111 |
+ if (!defined $response || !defined $response->{result}) { |
112 |
+ failed ("invalid json or result."); |
113 |
next; |
114 |
} |
115 |
|
116 |
@@ -4128,9 +4132,9 @@ |
117 |
|
118 |
# Strip header |
119 |
$reply =~ s/^.*?\n\n//s; |
120 |
- $response = JSON::Any->jsonToObj($reply); |
121 |
- if ($response->{result} eq 'error') { |
122 |
- failed ("%s", $response->{msg}); |
123 |
+ $response = eval {decode_json($reply)}; |
124 |
+ if (!defined $response || !defined $response->{result}) { |
125 |
+ failed ("invalid json or result."); |
126 |
} else { |
127 |
success ("%s -- Updated Successfully to %s", $domain, $ip); |
128 |
|