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