Menu

#51 Namecheap Update with same Hostnames in different domains

open
wimpunk
5
2013-01-14
2010-02-19
No

The patch from hankesels works fine, please add it to the trunk.
[Avatar]
2008-02-20 16:59:29 UTC
namecheap updates have this format:
host=[host_name]&domain=[domain.com]&password=[domain_password]&ip=[your_ip]

The host_name cannot contain the domain part. This causes problems when update of multiple namecheap hosted domains is attempted: Since the configuration is a hash keyed on host, hosts of the same name in multiple domains get overwritten in the hash.

The following small patch allows specifying a fully qualified host in the configuration, so that the hash keys are different, but strips off the domain part just before sending the update. The patch is against 3.7.3.

Han

$ diff -up ddclient.old ddclient
--- ddclient.old 2008-02-21 00:57:17.000000000 +0900
+++ ddclient 2008-02-21 01:36:42.000000000 +0900
@@ -3060,8 +3060,11 @@ sub nic_namecheap_update {

my $url;
$url = "http://$config{$h}{'server'}/update";
- $url .= "?host=$h";
- $url .= "&domain=$config{$h}{'login'}";
+ 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;

Discussion

  • wimpunk

    wimpunk - 2010-02-21

    Sorry, only patches which apply cleanly against the latest version of ddclient will be considered.

     
  • dr650

    dr650 - 2012-02-20

    Here is a clean patch and explanation for ddclient 3.8.1

    Multiple Domain Updates with ddclient 3.8.1 and namecheap.com

    Example ddclient.conf entries :

    ## namecheap foo.com
    protocol=namecheap, \ server=dynamicdns.park-your-domain.com, \ login=foo.com, \ password=nnn \ @.foo.com,www.foo.com

    ## namecheap foo.org
    protocol=namecheap, \ server=dynamicdns.park-your-domain.com, \ login=foo.org, \ password=mmm \ @.foo.org,www.foo.org

    With this patch applied to ddclient 3.8.1, all four
    domain entries are updated and cached. Without the
    patch, a domain syntax like '@,www' would be used
    and only the second section would be updated.

    The two sections logically become :

    https:://dynamicdns.park-your-domain.com/update?host=@&domain=foo.com&password=nnn&ip=xxx.xxx.xxx.xxx
    https:://dynamicdns.park-your-domain.com/update?host=www&domain=foo.com&password=nnn&ip=xxx.xxx.xxx.xxx
    https:://dynamicdns.park-your-domain.com/update?host=@&domain=foo.org&password=mmm&ip=xxx.xxx.xxx.xxx
    https:://dynamicdns.park-your-domain.com/update?host=www&domain=foo.org&password=mmm&ip=xxx.xxx.xxx.xxx

    Regards,
    John

    $ diff -up ddclient.old ddclient
    --- ddclient.old 2011-07-11 14:04:21.000000000 -0700
    +++ ddclient 2012-02-19 20:30:28.771160440 -0800
    @@ -3375,8 +3375,11 @@ sub nic_namecheap_update {

    my $url;
    $url = "http://$config{$h}{'server'}/update";
    - $url .= "?host=$h";
    - $url .= "&domain=$config{$h}{'login'}";
    + 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;

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.