gentoo-overlay/net-dns/ddclient/files/ddclient-3.8.0-everydns.patch

94 lines
3.4 KiB
Diff
Raw Normal View History

2011-05-12 12:11:55 +02:00
--- ddclient.orig 2011-05-12 09:48:40.000000000 +0000
+++ ddclient 2011-05-12 09:54:27.000000000 +0000
@@ -524,6 +524,16 @@
$variables{'service-common-defaults'},
),
},
+ 'everydns' => {
+ 'updateable' => undef,
+ 'update' => \&nic_everydns_update,
+ 'examples' => \&nic_everydns_examples,
+ 'variables' => merge(
+ { 'server' => setv(T_FQDNP, 1, 0, 1, 'dyn.everydns.net', undef) },
+ { 'min-interval' => setv(T_DELAY, 0, 0, 1, 0, interval('15m')) },
+ $variables{'service-common-defaults'},
+ ),
+ },
);
$variables{'merged'} = merge($variables{'global-defaults'},
$variables{'service-common-defaults'},
@@ -3377,6 +3387,73 @@
}
}
}
+######################################################################
+## nic_everydns_examples
+######################################################################
+sub nic_everydns_examples {
+ return <<EoEXAMPLE;
+o 'everydns'
+
+The 'everydns' protocol is the protocol used by the free dynamic
+DNS service offered by EveryDNS at www.everydns.net. So far it actually ignores the
+value of the domain, it just updates all domains associated with the account
+that belongs to the given credentials
+
+Configuration variables applicable to the 'everydns' protocol are:
+ protocol=everydns ##
+ server=dyn.everydns.net ## defaults to members.dyndns.org
+ login=service-login ## login name and password registered with the service
+ password=service-password ##
+ domain.name ## the domain registered with the service.
+
+Example ${program}.conf file entries:
+ ## single host update
+ protocol=everydns, \\
+ login=my-everydns.net-login, \\
+ password=my-everydns.net-password \\
+ my-example-domain.com
+
+EoEXAMPLE
+}
+######################################################################
+## nic_everydns_update
+######################################################################
+sub nic_everydns_update {
+ debug("\nnic_everydns_update -------------------");
+
+ ## update each configured domain
+ foreach my $h (@_) {
+ my $ip = delete $config{$h}{'wantip'};
+ info("setting IP address to %s for %s", $ip, $h);
+ verbose("UPDATE:","updating %s", $h);
+
+ my $url;
+ $url = "http://$config{$h}{'server'}/index.php";
+ $url .= "?ver=0.1";
+ $url .= "&ip=$ip" if $ip;
+ # $url .= "&domain=$d" if $d;
+
+ my $reply = geturl(opt('proxy'), $url, $config{$h}{'login'}, $config{$h}{'password'});
+ if (!defined($reply) || !$reply) {
+ failed("updating %s: Could not connect to %s.", $h, $config{$h}{'server'});
+ last;
+ }
+ last if !header_ok($h, $reply);
+
+ my @reply = split /\n/, $reply;
+ if (grep /^Exit Code: 0$/i, @reply) {
+ $config{$h}{'ip'} = $ip;
+ $config{$h}{'mtime'} = $now;
+ $config{$h}{'status'} = 'good';
+ success("updating %s: good: IP address set to %s", $h, $ip);
+ } else {
+ $config{$h}{'status'} = 'failed';
+ warning("SENT: %s", $url) unless opt('verbose');
+ warning("REPLIED: %s", $reply);
+ failed("updating %s: Invalid reply.", $h);
+ }
+ }
+}
######################################################################
# vim: ai ts=4 sw=4 tw=78 :