From e910af8bac4b11312577c4b46b3e96807cc64f84 Mon Sep 17 00:00:00 2001 From: Ian Colwell Date: Thu, 6 Jun 2019 19:37:51 +0800 Subject: [PATCH] Restore ability to update multiple namecheap domains (#64) * Revert to previous functionality * Revert example config * Remove redundant commas * Update example conf * Revert whitespace formatting --- ddclient | 16 +++++++++------- sample-etc_ddclient.conf | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ddclient b/ddclient index 5f65d95..09cc63a 100755 --- a/ddclient +++ b/ddclient @@ -3600,12 +3600,12 @@ Configuration variables applicable to the 'namecheap' protocol are: server=fqdn.of.service ## defaults to dynamicdns.park-your-domain.com login=service-login ## login name and password registered with the service password=service-password ## - hostname ## the hostname to update. + fully.qualified.host ## the hostname to update. Example ${program}.conf file entries: ## single host update - protocol=namecheap, \\ - login=my-namecheap.com-login, \\ + protocol=namecheap \\ + login=my-namecheap.com-login \\ password=my-namecheap.com-password \\ myhost @@ -3630,15 +3630,17 @@ sub nic_namecheap_update { ## update each configured host foreach my $h (@_) { - my $ip = delete $config{$h}{'wantip'}; + my $ip = delete $config{$h}{'wantip'}; info("setting IP address to %s for %s", $ip, $h); verbose("UPDATE:","updating %s", $h); my $url; $url = "https://$config{$h}{'server'}/update"; - my $domain = $config{$h}{'login'}; - $url .= "?host=$h"; - $url .= "&domain=$domain"; + my $domain = $config{$h}{'login'}; + my $host = $h; + $host =~ s/(.*)\.$domain(.*)/$1$2/; + $url .= "?host=$host"; + $url .= "&domain=$domain"; $url .= "&password=$config{$h}{'password'}"; $url .= "&ip="; $url .= $ip if $ip; diff --git a/sample-etc_ddclient.conf b/sample-etc_ddclient.conf index 30b0ca4..8630634 100644 --- a/sample-etc_ddclient.conf +++ b/sample-etc_ddclient.conf @@ -161,7 +161,7 @@ ssl=yes # use ssl-support. Works with # server=dynamicdns.park-your-domain.com, \ # login=my-namecheap.com-login, \ # password=my-namecheap.com-password \ -# myhost.namecheap.com +# fully.qualified.host ## ##