zone is now a configuration variable
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 5 Mar 2014 21:53:07 +0000 (22:53 +0100)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 5 Mar 2014 21:53:07 +0000 (22:53 +0100)
cgi-bin/dyndns.py

index 6087beb..f9919dd 100755 (executable)
@@ -12,6 +12,7 @@ import ipaddr
 
 # Configuration
 PASSWORD = 'hygCithOrs5'
+ZONE = '.dyn.colgarra.priv.at'
 
 
 # Just for debugging:
@@ -27,7 +28,9 @@ hostname = fields.getvalue('hostname')
 myip     = fields.getvalue('myip')
 
 # Strip zone
-hostname = re.sub('\.dyn\.colgarra\.priv\.at\s*$', '', hostname)
+hostname = hostname.strip()
+if hostname.endswith(ZONE):
+       hostname = hostname[:-len(ZONE)]
 
 try:
        # check username