]> git.ipfire.org Git - oddments/ddns.git/commitdiff
Merge remote-tracking branch 'stevee/zoneedit.com'
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 22 Jun 2014 10:28:30 +0000 (10:28 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 22 Jun 2014 10:28:30 +0000 (10:28 +0000)
ddns.conf.sample
src/ddns/__init__.py
src/ddns/providers.py

index 0a057823367d08f4812167816edb51bef43d535e..29b1ef19570d4e0b4b2f8f7727c2a66574ca05cb 100644 (file)
 # username = user
 # password = pass
 # proto = ipv4 OR ipv6
+
+# [test.zoneedit.com]
+# provider = zoneedit.com
+# username = user
+# password = pass
+# proto = ipv4 OR ipv6 
index 7e5be0022721697f67fd9cbec6df335e2f5451bb..e4e484e01323db1187d4640b11600765c0738618 100644 (file)
@@ -110,6 +110,7 @@ class DDNSCore(object):
                        DDNSProviderTwoDNS,
                        DDNSProviderUdmedia,
                        DDNSProviderVariomedia,
+                       DDNSProviderZoneedit,
                ):
                        self.register_provider(provider)
 
index aa4546c36bdbf106240c62b09c852ec4b4fdc7bc..2a5115608fd41d7d1d7a0ecf31596ac68c94433a 100644 (file)
@@ -857,3 +857,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