]> git.ipfire.org Git - ddns.git/commitdiff
Merge branch 'zoneedit-10645'
authorStefan Schantl <stefan.schantl@ipfire.org>
Thu, 22 Jan 2015 17:21:47 +0000 (18:21 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 22 Jan 2015 17:21:47 +0000 (18:21 +0100)
README
ddns.conf.sample
src/ddns/providers.py

diff --git a/README b/README
index 59441021ca1c5b4568d0701e077413aa313629c9..6a06f4b132c179559a5f1d353828a533e91d7e79 100644 (file)
--- a/README
+++ b/README
@@ -49,6 +49,7 @@ INSTALLATION:
 
 SUPPORTED PROVIDERS:
        all-inkl.com
+       changeip.com
        dhs.org
        dns.lightningwirelabs.com
        dnspark.com
index d3ac53fa7e91fa043a835f70637ea2b27105dab1..0048a46747c614ec6fb470359864036d4d9a8a04 100644 (file)
 # secret = XYZ
 # ttl = 60
 
+# [test.changeip.com]
+# provider = changeip.com
+# username = user
+# password = pass
+
 # [test.dhs.org]
 # provider = dhs.org
 # username = user
index 0f873438e1ff5b0e7b54697ed8f70a881fefbeee..9d6f6eec93947c2355ba368a6ecc43e1ce01ec38 100644 (file)
@@ -539,6 +539,44 @@ class DDNSProviderBindNsupdate(DDNSProvider):
                return "\n".join(scriptlet)
 
 
+class DDNSProviderChangeIP(DDNSProvider):
+       handle    = "changeip.com"
+       name      = "ChangeIP.com"
+       website   = "https://changeip.com"
+       protocols = ("ipv4",)
+
+       # Detailed information about the update api can be found here.
+       # http://www.changeip.com/accounts/knowledgebase.php?action=displayarticle&id=34
+
+       url = "https://nic.changeip.com/nic/update"
+       can_remove_records = False
+
+       def update_protocol(self, proto):
+               data = {
+                       "hostname" : self.hostname,
+                       "myip"     : self.get_address(proto),
+               }
+
+               # Send update to the server.
+               try:
+                       response = self.send_request(self.url, username=self.username, password=self.password,
+                               data=data)
+
+               # Handle error codes.
+               except urllib2.HTTPError, e:
+                       if e.code == 422:
+                               raise DDNSRequestError(_("Domain not found."))
+
+                       raise
+
+               # Handle success message.
+               if response.code == 200:
+                       return
+
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError(_("Server response: %s") % output)
+
+
 class DDNSProviderDHS(DDNSProvider):
        handle    = "dhs.org"
        name      = "DHS International"
@@ -716,18 +754,54 @@ class DDNSProviderDynU(DDNSProtocolDynDNS2, DDNSProvider):
                self.send_request(data)
 
 
-class DDNSProviderEasyDNS(DDNSProtocolDynDNS2, DDNSProvider):
+class DDNSProviderEasyDNS(DDNSProvider):
        handle    = "easydns.com"
        name      = "EasyDNS"
        website   = "http://www.easydns.com/"
        protocols = ("ipv4",)
 
-       # There is only some basic documentation provided by the vendor,
-       # also searching the web gain very poor results.
-       # http://mediawiki.easydns.com/index.php/Dynamic_DNS
+       # Detailed information about the request and response codes
+       # (API 1.3) are available on the providers webpage.
+       # https://fusion.easydns.com/index.php?/Knowledgebase/Article/View/102/7/dynamic-dns
 
        url = "http://api.cp.easydns.com/dyn/tomato.php"
 
+       def update_protocol(self, proto):
+               data = {
+                       "myip"     : self.get_address(proto, "-"),
+                       "hostname" : self.hostname,
+               }
+
+               # Send update to the server.
+               response = self.send_request(self.url, data=data,
+                       username=self.username, password=self.password)
+
+               # Get the full response message.
+               output = response.read()
+
+               # Remove all leading and trailing whitespace.
+               output = output.strip()
+
+               # Handle success messages.
+               if output.startswith("NOERROR"):
+                       return
+
+               # Handle error codes.
+               if output.startswith("NOACCESS"):
+                       raise DDNSAuthenticationError
+
+               elif output.startswith("NOSERVICE"):
+                       raise DDNSRequestError(_("Dynamic DNS is not turned on for this domain."))
+
+               elif output.startswith("ILLEGAL INPUT"):
+                       raise DDNSRequestError(_("Invalid data has been sent."))
+
+               elif output.startswith("TOOSOON"):
+                       raise DDNSRequestError(_("Too frequent update requests have been sent."))
+
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError
+
 
 class DDNSProviderDomopoli(DDNSProtocolDynDNS2, DDNSProvider):
        handle    = "domopoli.de"
@@ -1233,7 +1307,7 @@ class DDNSProviderSPDNS(DDNSProtocolDynDNS2, DDNSProvider):
 
        @property
        def password(self):
-               return self.get("username") or self.token
+               return self.get("password") or self.token
 
 
 class DDNSProviderStrato(DDNSProtocolDynDNS2, DDNSProvider):