Add DNSmadeEasy as new provider.
authorMarco Götze <account@solariz.de>
Wed, 22 Apr 2015 18:36:07 +0000 (20:36 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 9 Jul 2015 19:27:41 +0000 (21:27 +0200)
Fixes #10811.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
README
ddns.conf.sample
src/ddns/providers.py

diff --git a/README b/README
index 4ae3883..9e924a1 100644 (file)
--- a/README
+++ b/README
@@ -53,6 +53,7 @@ SUPPORTED PROVIDERS:
        ddnss.de
        dhs.org
        dns.lightningwirelabs.com
+       dnsmadeeasy.com
        dnspark.com
        domains.google.com
        domopoli.de
index 0cab899..bc42319 100644 (file)
 # username = user
 # password = pass
 
+# [test.dnsmadeeasy.com]
+# provider = dnsmadeeasy.com
+# username = user
+# password = pass
+
 # [test.dtdns.org]
 # provider = dtdns.org
 # password = pass
index 9eaaa6c..e708fd6 100644 (file)
@@ -1552,6 +1552,54 @@ class DDNSProviderZoneedit(DDNSProvider):
                raise DDNSUpdateError
 
 
+class DDNSProviderDNSmadeEasy(DDNSProvider):
+       handle    = "dnsmadeeasy.com"
+       name      = "DNSmadeEasy.com"
+       website   = "http://www.dnsmadeeasy.com/"
+       protocols = ("ipv4",)
+
+       # DNS Made Easy Nameserver Provider also offering Dynamic DNS
+       # Documentation can be found here:
+       # http://www.dnsmadeeasy.com/dynamic-dns/
+
+       url = "https://cp.dnsmadeeasy.com/servlet/updateip?"
+       can_remove_records = False
+
+       def update_protocol(self, proto):
+               data = {
+                       "ip" : self.get_address(proto),
+                       "id" : self.hostname,
+                       "username" : self.username,
+                       "password" : self.password,
+               }
+
+               # Send update to the server.
+               response = self.send_request(self.url, data=data)
+
+               # Get the full response message.
+               output = response.read()
+
+               # Handle success messages.
+               if output.startswith("success") or output.startswith("error-record-ip-same"):
+                       return
+
+               # Handle error codes.
+               if output.startswith("error-auth-suspend"):
+                       raise DDNSRequestError(_("Account has been suspended."))
+
+               elif output.startswith("error-auth-voided"):
+                       raise DDNSRequestError(_("Account has been revoked."))
+
+               elif output.startswith("error-record-invalid"):
+                       raise DDNSRequestError(_("Specified host does not exist."))
+
+               elif output.startswith("error-auth"):
+                       raise DDNSAuthenticationError
+
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError(_("Server response: %s") % output)
+
+
 class DDNSProviderZZZZ(DDNSProvider):
        handle    = "zzzz.io"
        name      = "zzzz"