X-Git-Url: https://git.ralfj.de/dyn-nsupdate.git/blobdiff_plain/b93521c8aa60ed1d6dc5d537dd13aaddaf910344..cbd82106a0d558593db0b51c098c281fa75bc442:/server-scripts/update diff --git a/server-scripts/update b/server-scripts/update index 02a52c3..183f2db 100755 --- a/server-scripts/update +++ b/server-scripts/update @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python2 # Copyright (c) 2014, Ralf Jung # All rights reserved. # @@ -21,10 +21,6 @@ # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# The views and conclusions contained in the software and documentation are those -# of the authors and should not be interpreted as representing official policies, -# either expressed or implied, of the FreeBSD Project. import cgi, os, sys, subprocess form = cgi.FieldStorage(keep_blank_values=True) @@ -38,10 +34,12 @@ if "password" not in form or "domain" not in form or ("ip" not in form and "ipv6 print "Mandatory argument missing: You must supply all of 'password', 'domain' and at least either 'ip' or 'ipv6'" sys.exit() -domain = str(form.getvalue("domain")) -password = str(form.getvalue("password")) -ip = str(form.getvalue("ip")) -ipv6 = str(form.getvalue("ipv6")) +domain = form.getfirst("domain") +password = form.getfirst("password") +ip = form.getfirst("ip") +ipv6 = form.getfirst("ipv6") +assert domain is not None and password is not None +assert ip is not None or ipv6 is not None # run update program args = ["/var/lib/bind/dyn-nsupdate", "--domain", domain, "--password", password] @@ -59,4 +57,9 @@ if p.returncode or stderr or stdout: if stdout: print stdout if stderr: print stderr else: - print "good",ip + out = "good" + if ip is not None: + out += " "+ip + if ipv6 is not None: + out += " "+ipv6 + print out