]> git.ipfire.org Git - ddns.git/commitdiff
Add Zoneedit as new provider.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sat, 21 Jun 2014 16:00:47 +0000 (18:00 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sat, 21 Jun 2014 16:00:47 +0000 (18:00 +0200)
ddns.conf.sample
src/ddns/__init__.py
src/ddns/providers.py

index 3e73842058acf7910845c04b9096c691e19766b9..68756f53e62b187ca13e6fe3e31898a20549dbb0 100644 (file)
@@ -99,3 +99,9 @@
 # username = user
 # password = pass
 # proto = ipv4 OR ipv6
+
+# [test.zoneedit.com]
+# provider = zoneedit.com
+# username = user
+# password = pass
+# proto = ipv4 OR ipv6 
index a764c2ce4804bb9b29c20fb436c79fe02526f51a..65e61d50062b5f56acdf5c1d2980e0ac5bdb6176 100644 (file)
@@ -107,6 +107,7 @@ class DDNSCore(object):
                        DDNSProviderSelfhost,
                        DDNSProviderSPDNS,
                        DDNSProviderVariomedia,
+                       DDNSProviderZoneedit,
                ):
                        self.register_provider(provider)
 
index acd0253170cacef460799ba39289c7c0bbeb9a41..06cade872f85d8372e6c83add2a5fa3d10e00979 100644 (file)
@@ -806,3 +806,51 @@ class DDNSProviderVariomedia(DDNSProviderDynDNS):
                }
 
                return data
+
+
+class DDNSProviderZoneedit(DDNSProvider):
+       INFO = {
+               "handle"    : "zoneedit.com",
+               "name"      : "Zoneedit",
+               "website"   : "http://www.zoneedit.com",
+               "protocols" : ["ipv6", "ipv4",]
+       }
+
+       # Detailed information about the request and the response codes can be
+       # obtained here:
+       # http://www.zoneedit.com/doc/api/other.html
+       # http://www.zoneedit.com/faq.html
+
+       url = "https://dynamic.zoneedit.com/auth/dynamic.html"
+
+       @property
+       def proto(self):
+               return self.get("proto")
+
+       def update(self):
+               data = {
+                       "dnsto" : self.get_address(self.proto),
+                       "host"  : self.hostname
+               }
+
+               # Send update to the server.
+               response = self.send_request(self.url, username=self.username, password=self.password,
+                       data=data)
+
+               # Get the full response message.
+               output = response.read()
+
+               # Handle success messages.
+               if output.startswith("<SUCCESS"):
+                       return
+
+               # Handle error codes.
+               if output.startswith("invalid login"):
+                       raise DDNSAuthenticationError
+               elif output.startswith("<ERROR CODE=\"704\""):
+                       raise DDNSRequestError(_("No valid FQDN was given.")) 
+               elif output.startswith("<ERROR CODE=\"702\""):
+                       raise DDNSInternalServerError
+
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError