]> git.ipfire.org Git - oddments/ddns.git/blobdiff - src/ddns/providers.py
Merge remote-tracking branch 'stevee/zoneedit.com'
[oddments/ddns.git] / src / ddns / providers.py
index 9ffd264b916ffc7e655b3ae639b7153bd31e469a..2a5115608fd41d7d1d7a0ecf31596ac68c94433a 100644 (file)
@@ -20,6 +20,7 @@
 ###############################################################################
 
 import logging
+import urllib2
 import xml.dom.minidom
 
 from i18n import _
@@ -168,6 +169,47 @@ class DDNSProvider(object):
                return self.core.system.get_address(proto)
 
 
+class DDNSProviderAllInkl(DDNSProvider):
+       INFO = {
+               "handle"    : "all-inkl.com",
+               "name"      : "All-inkl.com",
+               "website"   : "http://all-inkl.com/",
+               "protocols" : ["ipv4",]
+       }
+
+       # There are only information provided by the vendor how to
+       # perform an update on a FRITZ Box. Grab requried informations
+       # from the net.
+       # http://all-inkl.goetze.it/v01/ddns-mit-einfachen-mitteln/
+
+       url = "http://dyndns.kasserver.com"
+
+       def update(self):
+
+               # There is no additional data required so we directly can
+               # send our request.
+               try:
+                       # Send request to the server.
+                       response = self.send_request(self.url, username=self.username, password=self.password)
+
+                       # Handle 401 HTTP Header (Authentication Error)
+               except urllib2.HTTPError, e:
+                       if e.code == 401:
+                               raise DDNSAuthenticationError
+
+                       raise
+
+               # Get the full response message.
+               output = response.read()
+
+               # Handle success messages.
+               if output.startswith("good") or output.startswith("nochg"):
+                       return
+
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError
+
+
 class DDNSProviderDHS(DDNSProvider):
        INFO = {
                "handle"    : "dhs.org",
@@ -740,6 +782,57 @@ class DDNSProviderSPDNS(DDNSProviderDynDNS):
        url = "https://update.spdns.de/nic/update"
 
 
+class DDNSProviderStrato(DDNSProviderDynDNS):
+       INFO = {
+               "handle"    : "strato.com",
+               "name"      : "Strato AG",
+               "website"   : "http:/www.strato.com/",
+               "protocols" : ["ipv4",]
+       }
+
+       # Information about the request and response can be obtained here:
+       # http://www.strato-faq.de/article/671/So-einfach-richten-Sie-DynDNS-f%C3%BCr-Ihre-Domains-ein.html
+
+       url = "https://dyndns.strato.com/nic/update"
+
+
+class DDNSProviderTwoDNS(DDNSProviderDynDNS):
+       INFO = {
+               "handle"    : "twodns.de",
+               "name"      : "TwoDNS",
+               "website"   : "http://www.twodns.de",
+               "protocols" : ["ipv4",]
+       }
+
+       # Detailed information about the request can be found here
+       # http://twodns.de/en/faqs
+       # http://twodns.de/en/api
+
+       url = "https://update.twodns.de/update"
+
+       def _prepare_request_data(self):
+               data = {
+                       "ip" : self.get_address("ipv4"),
+                       "hostname" : self.hostname
+               }
+
+               return data
+
+
+class DDNSProviderUdmedia(DDNSProviderDynDNS):
+       INFO = {
+               "handle"    : "udmedia.de",
+               "name"      : "Udmedia GmbH",
+               "website"   : "http://www.udmedia.de",
+               "protocols" : ["ipv4",]
+       }
+
+       # Information about the request can be found here
+       # http://www.udmedia.de/faq/content/47/288/de/wie-lege-ich-einen-dyndns_eintrag-an.html
+
+       url = "https://www.udmedia.de/nic/update"
+
+
 class DDNSProviderVariomedia(DDNSProviderDynDNS):
        INFO = {
                "handle"   : "variomedia.de",
@@ -764,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