Index: ddclient =================================================================== --- ddclient (Revision 52) +++ ddclient (Arbeitskopie) @@ -464,6 +464,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'}, @@ -3122,8 +3132,74 @@ } } } +###################################################################### +## 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 $d (@_) { + info("setting IP address to %s for %s", $ip, $d); + verbose("UPDATE:","updating %s", $d); + + my $url; + $url = "http://$config{$d}{'server'}/index.php"; + $url .= "?ver=0.1"; + $url .= "&ip=$ip" if $ip; + # $url .= "&domain=$d" if $d; + + my $reply = geturl(opt('proxy'), $url, $config{$d}{'login'}, $config{$d}{'password'}); + if (!defined($reply) || !$reply) { + failed("updating %s: Could not connect to %s.", $d, $config{$d}{'server'}); + last; + } + last if !header_ok($d, $reply); + + my @reply = split /\n/, $reply; + if (grep /^Exit Code: 0$/i, @reply) { + $config{$d}{'ip'} = $ip; + $config{$d}{'mtime'} = $now; + $config{$d}{'status'} = 'good'; + success("updating %s: good: IP address set to %s", $d, $ip); + } else { + $config{$d}{'status'} = 'failed'; + warning("SENT: %s", $url) unless opt('verbose'); + warning("REPLIED: %s", $reply); + failed("updating %s: Invalid reply.", $d); + } + } +} + +###################################################################### # vim: ai ts=4 sw=4 tw=78 :