]> git.ipfire.org Git - oddments/ddns.git/commitdiff
Add ddnss.de as new provider.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sat, 24 Jan 2015 14:01:24 +0000 (15:01 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sat, 24 Jan 2015 14:01:24 +0000 (15:01 +0100)
README
ddns.conf.sample
src/ddns/providers.py

diff --git a/README b/README
index 6a06f4b132c179559a5f1d353828a533e91d7e79..69d7e7f4ae11ee60b6d22e08e6c2b3266829a431 100644 (file)
--- a/README
+++ b/README
@@ -50,6 +50,7 @@ INSTALLATION:
 SUPPORTED PROVIDERS:
        all-inkl.com
        changeip.com
+       ddnss.de
        dhs.org
        dns.lightningwirelabs.com
        dnspark.com
index 0048a46747c614ec6fb470359864036d4d9a8a04..7ada339095e5b6e16c37704b25e104242983dce9 100644 (file)
 # username = user
 # password = pass
 
+# [test.ddnss.de]
+# provider = ddnss.de
+#
+# Only use one of these two auth options.
+# token = token
+# username = user
+# password = pass
+
 # [test.dhs.org]
 # provider = dhs.org
 # username = user
index 9d6f6eec93947c2355ba368a6ecc43e1ce01ec38..b30827cd10b566a5766739aa5ea0f2097dd45c1b 100644 (file)
@@ -577,6 +577,72 @@ class DDNSProviderChangeIP(DDNSProvider):
                raise DDNSUpdateError(_("Server response: %s") % output)
 
 
+class DDNSProviderDDNSS(DDNSProvider):
+       handle    = "ddnss.de"
+       name      = "DDNSS"
+       website   = "http://www.ddnss.de"
+       protocols = ("ipv4",)
+
+       # Detailed information about how to send the update request and possible response
+       # codes can be obtained from here.
+       # http://www.ddnss.de/info.php
+       # http://www.megacomputing.de/2014/08/dyndns-service-response-time/#more-919
+
+       url = "http://www.ddnss.de/upd.php"
+       can_remove_records = False
+
+       def update_protocol(self, proto):
+               data = {
+                       "ip"   : self.get_address(proto),
+                       "host" : self.hostname,
+               }
+
+               # Check if a token has been set.
+               if self.token:
+                       data["key"] = self.token
+
+               # Check if username and hostname are given.
+               elif self.username and self.password:
+                       data.update({
+                               "user" : self.username,
+                               "pwd"  : self.password,
+                       })
+
+               # Raise an error if no auth details are given.
+               else:
+                       raise DDNSConfigurationError
+
+               # Send update to the server.
+               response = self.send_request(self.url, data=data)
+
+               # This provider sends the response code as part of the header.
+               header = response.info()
+
+               # Get status information from the header.
+               output = header.getheader('ddnss-response')
+
+               # Handle success messages.
+               if output == "good" or output == "nochg":
+                       return
+
+               # Handle error codes.
+               if output == "badauth":
+                       raise DDNSAuthenticationError
+               elif output == "notfqdn":
+                       raise DDNSRequestError(_("No valid FQDN was given."))
+               elif output == "nohost":
+                       raise DDNSRequestError(_("Specified host does not exist."))
+               elif output == "911":
+                       raise DDNSInternalServerError
+               elif output == "dnserr":
+                       raise DDNSInternalServerError(_("DNS error encountered."))
+               elif output == "disabled":
+                       raise DDNSRequestError(_("Account disabled or locked."))
+
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError
+
+
 class DDNSProviderDHS(DDNSProvider):
        handle    = "dhs.org"
        name      = "DHS International"