2 import cgi, os, sys, subprocess
3 form = cgi.FieldStorage()
6 print "Content-Type: text/plain"
10 if "password" not in form or "domain" not in form or "ip" not in form:
11 print "Mandatory argument missing: You must supply all of 'password', 'domain', 'ip'"
15 domain = form["domain"].value
16 password = form["password"].value
19 p = subprocess.Popen(["/var/lib/named/dyn-nsupdate", domain, password, ip], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
20 (stdout, stderr) = p.communicate()
23 if p.returncode or stderr or stdout:
25 print "There was an error while updating the DNS: Return code %d" % p.returncode
26 if stdout: print stdout
27 if stderr: print stderr