]> git.ipfire.org Git - oddments/ddns.git/commitdiff
Merge branch 'dyns.cx'
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 3 Sep 2014 06:00:57 +0000 (08:00 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Wed, 3 Sep 2014 06:00:57 +0000 (08:00 +0200)
1  2 
ddns.conf.sample
src/ddns/providers.py

diff --combined ddns.conf.sample
index 2ede3a497db70b6951bb39064ca0a85b81630c71,e2f61ea285fface11effe62bec0188f55f7b5e75..cf4d6a2ef44b8e547e4f8e20126469679357f9e5
  # username = user
  # password = pass
  
+ # [text.dyns.net]
+ # provider = dyns.net
+ # username = user
+ # password = pass
  # [test.dynu.com]
  # provider = dynu.com
  # username = user
  
  # [test.spdns.org]
  # provider = spdns.org
 +
 +# Only use one the these two auth options.
 +# token = token
  # username = user
  # password = pass
  
diff --combined src/ddns/providers.py
index 2309257cde2cc8f243e7c3a9122d53cd9a5f01c6,2ffc35d50953da4fe44823c5b7b647f05d34c4c3..a9893b86213f3784b7a2bb248ec13b33badd4836
@@@ -556,6 -556,50 +556,50 @@@ class DDNSProviderDomopoli(DDNSProtocol
        url = "http://dyndns.domopoli.de/nic/update"
  
  
+ class DDNSProviderDynsNet(DDNSProvider):
+       handle    = "dyns.net"
+       name      = "DyNS"
+       website   = "http://www.dyns.net/"
+       protocols = ("ipv4",)
+       # There is very detailed informatio about how to send the update request and
+       # the possible response codes. (Currently we are using the v1.1 proto)
+       # http://www.dyns.net/documentation/technical/protocol/
+       url = "http://www.dyns.net/postscript011.php"
+       def update(self):
+               data = {
+                       "ip"       : self.get_address("ipv4"),
+                       "host"     : 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("200"):
+                       return
+               # Handle error codes.
+               if output.startswith("400"):
+                       raise DDNSRequestError(_("Malformed request has been sent."))
+               elif output.startswith("401"):
+                       raise DDNSAuthenticationError
+               elif output.startswith("402"):
+                       raise DDNSRequestError(_("Too frequent update requests have been sent."))
+               elif output.startswith("403"):
+                       raise DDNSInternalServerError
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError(_("Server response: %s") % output) 
  class DDNSProviderEnomCom(DDNSResponseParserXML, DDNSProvider):
        handle    = "enom.com"
        name      = "eNom Inc."
@@@ -986,14 -1030,6 +1030,14 @@@ class DDNSProviderSPDNS(DDNSProtocolDyn
  
        url = "https://update.spdns.de/nic/update"
  
 +      @property
 +      def username(self):
 +              return self.get("username") or self.hostname
 +
 +      @property
 +      def password(self):
 +              return self.get("username") or self.token
 +
  
  class DDNSProviderStrato(DDNSProtocolDynDNS2, DDNSProvider):
        handle    = "strato.com"