updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / ddclient-valuedomain / ddclient-valuedomain-3.8.1.patch
blob36ea85395550e5e35eaea5744d2352792b91810b
1 --- ddclient.old 2011-11-28 06:20:43.993483966 +0900
2 +++ ddclient 2011-11-28 06:47:18.383505412 +0900
3 @@ -563,6 +563,16 @@
4 $variables{'service-common-defaults'},
5 ),
6 },
7 + 'valuedomain' => {
8 + 'updateable' => undef,
9 + 'update' => \&nic_valuedomain_update,
10 + 'examples' => \&nic_valuedomain_examples,
11 + 'variables' => merge(
12 + { 'server' => setv(T_FQDNP, 1, 0, 1, 'dyn.value-domain.com', undef) },
13 + { 'login' => setv(T_FQDN , 1, 0, 1, '', undef) },
14 + $variables{'service-common-defaults'}
15 + ),
16 + },
18 $variables{'merged'} = merge($variables{'global-defaults'},
19 $variables{'service-common-defaults'},
20 @@ -2183,16 +2193,16 @@
22 } elsif (defined($sub) && &$sub($host)) {
23 $update = 1;
24 - } elsif ((defined($cache{$host}{'static'}) && defined($config{$host}{'static'}) &&
25 - ($cache{$host}{'static'} ne $config{$host}{'static'})) ||
26 - (defined($cache{$host}{'wildcard'}) && defined($config{$host}{'wildcard'}) &&
27 - ($cache{$host}{'wildcard'} ne $config{$host}{'wildcard'})) ||
28 - (defined($cache{$host}{'mx'}) && defined($config{$host}{'mx'}) &&
29 - ($cache{$host}{'mx'} ne $config{$host}{'mx'})) ||
30 - (defined($cache{$host}{'backupmx'}) && defined($config{$host}{'backupmx'}) &&
31 - ($cache{$host}{'backupmx'} ne $config{$host}{'backupmx'})) ) {
32 - info("updating %s because host settings have been changed.", $host);
33 - $update = 1;
34 +# } elsif ((defined($cache{$host}{'static'}) && defined($config{$host}{'static'}) &&
35 +# ($cache{$host}{'static'} ne $config{$host}{'static'})) ||
36 +# (defined($cache{$host}{'wildcard'}) && defined($config{$host}{'wildcard'}) &&
37 +# ($cache{$host}{'wildcard'} ne $config{$host}{'wildcard'})) ||
38 +# (defined($cache{$host}{'mx'}) && defined($config{$host}{'mx'}) &&
39 +# ($cache{$host}{'mx'} ne $config{$host}{'mx'})) ||
40 +# (defined($cache{$host}{'backupmx'}) && defined($config{$host}{'backupmx'}) &&
41 +# ($cache{$host}{'backupmx'} ne $config{$host}{'backupmx'})) ) {
42 +# info("updating %s because host settings have been changed.", $host);
43 +# $update = 1;
45 } else {
46 success("%s: skipped: IP address was already set to %s.", $host, $ip)
47 @@ -3671,6 +3681,117 @@
51 +######################################################################
53 +######################################################################
54 +## nic_valuedomain_examples
55 +######################################################################
56 +sub nic_valuedomain_examples {
57 + return <<EoEXAMPLE;
59 +o 'valuedomain'
61 +The 'valuedomain' protocol is used by DNS services offered by www.value-domain.com.
63 +Configuration variables applicable to the 'valuedomain' protocol are:
64 + protocol=valuedomain ##
65 + server=fqdn.of.service ## defaults to dyn.value-domain.com
66 + login=my-domain.name ## your domain name and password registered with the service
67 + password=service-password ##
68 + host.my-domain.name ## the host registered with the service.
70 +Example ${program}.conf file entries:
71 + ## single host update
72 + protocol=valuedomain, \\
73 + login=my-domain.name, \\
74 + password=my-domainname.com-password \\
75 + myhost.my-domainname
77 + ## single host update for wild (*.my-domain.name) support
78 + protocol=valuedomain, \\
79 + login=my-domain.name, \\
80 + password=my-domainname.com-password \\
81 + *.my-domain.name
83 + ## multiple host update
84 + protocol=valuedomain, \\
85 + login=my-domain.name, \\
86 + password=my-domainname.com-password \\
87 + myhost.my-domain.name,my2ndhost.my-domain.name
89 +EoEXAMPLE
91 +######################################################################
92 +## nic_valuedomain_update
93 +##
94 +## written by Hideo Sato
95 +##
96 +## update by irgaly <irgaly@gmail.com>
97 +## 2011/1/16: Support normal style host name.
98 +## You can set host name like 'www.example.com' otherwise 'www'.
99 +## This change lets you to manage more than one domain on Value Domain.
101 +## based on http://www.value-domain.com/ddns.php?action=howto
102 +## needs this url to update:
103 +## http://dyn.value-domain.com/cgi-bin/dyn.fcg?d=domain-name&p=password&h=hostname&i=IPaddress
105 +######################################################################
106 +sub nic_valuedomain_update {
109 + debug("\nnic_valuedomain_update -------------------");
111 + ## update each configured host
112 + foreach my $h (@_) {
113 + my $ip = delete $config{$h}{'wantip'};
114 + info("setting IP address to %s for %s", $ip, $h);
115 + verbose("UPDATE:","updating %s", $h);
117 + # convert host name to valuedomain style.
118 + # ex.) example.com -> @, www.example.com -> www
119 + my $exp = $config{$h}{'login'};
120 + $exp =~ s/\./\\./g;
121 + my $vd_host = $h;
122 + $vd_host =~ s/\.?$exp$//g;
123 + $vd_host = '@' unless length($vd_host);
124 + debug("VALUE DOMAIN host name is %s", $vd_host);
126 + my $url;
127 + $url = "http://$config{$h}{'server'}/cgi-bin/dyn.fcg";
128 + $url .= "?d=$config{$h}{'login'}";
129 + $url .= "&p=$config{$h}{'password'}";
130 + $url .= "&h=$vd_host";
131 + $url .= "&i=";
132 + $url .= $ip if $ip;
134 + my $reply = geturl(opt('proxy'), $url);
135 + if (!defined($reply) || !$reply) {
136 + failed("updating %s: Could not connect to %s.", $h, $config{$h}{'server'});
137 + last;
139 + last if !header_ok($h, $reply);
141 + my @reply = split /\n/, $reply;
142 + my ($return_code, $return_description) = ('','');
143 + foreach my $line (@reply) {
144 + $return_code = $1 if $line =~ m%^status=(.*)\s*$%i;
145 + $return_description = $line;
148 + if ($return_code !~ /0/) {
149 + $config{$h}{'status'} = 'failed';
150 + warning("SENT: %s", $url) unless opt('verbose');
151 + warning("REPLIED: %s", $reply);
152 + failed("updating %s", $h);
153 + } else {
154 + $config{$h}{'ip'} = $ip;
155 + $config{$h}{'mtime'} = $now;
156 + $config{$h}{'status'} = 'good';
157 + success("updating %s: %s: %s: IP address set to %s", $h, $return_code, $return_description, $ip);
162 ######################################################################
163 # vim: ai ts=4 sw=4 tw=78 :
165 --- sample-etc_ddclient.conf.old 2011-11-28 06:47:34.346836170 +0900
166 +++ sample-etc_ddclient.conf 2011-11-28 06:50:41.560172977 +0900
167 @@ -186,3 +186,11 @@
168 # client=ddclient,
169 # password=my-dtdns.com-password
170 # myhost.dtdns.net, otherhost.dtdns.net
173 +## VALUE-DOMAIN (www.value-domain.com)
175 +# protocol=valuedomain,
176 +# login=my-domain.name,
177 +# password=my-domainname.com-password
178 +# myhost.my-domain.name,my2ndhost.my-domain.name