From 9b941ce45484431bf095ffc39f242e81c716cbd5 Mon Sep 17 00:00:00 2001 From: Martin Nagy Date: Tue, 9 Dec 2008 19:31:51 +0100 Subject: Initial import. --- contrib/dbus/SetForwarders | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 contrib/dbus/SetForwarders (limited to 'contrib/dbus/SetForwarders') diff --git a/contrib/dbus/SetForwarders b/contrib/dbus/SetForwarders new file mode 100755 index 0000000..8ee4ce1 --- /dev/null +++ b/contrib/dbus/SetForwarders @@ -0,0 +1,52 @@ +#!/bin/bash +# +# This script uses the named D-BUS support, which must be enabled in +# the running named with the named '-D' option, to set the forwarding zones +# in the running server. +# +# One zone argument is required, followed by any number of server IP (v4 or v6) +# addresses. If the server IP address list is empty, any forwarders for the zone +# will be removed. +# +# Usage: +# SetForwarders [ -t <'first' | 'only'> ] [ [...] ] +# +# Copyright(C) Jason Vas Dias Red Hat Inc. 2005 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation at +# http://www.fsf.org/licensing/licenses/gpl.txt +# and included in this software distribution as the "LICENSE" file. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +usage() { echo "Usage: SetForwarders [ -t <'first' | 'only'> ] [ [...] ]"; } +type='' +if [ $# -eq 0 ]; then + usage; + exit 1; +elif [ "$1" = "-t" ]; then + if [ $# -lt 2 ]; then + echo '-t option requires an argument.' + exit 1; + fi; + type=$2; + shift 2; +fi; +if [ $# -lt 1 ]; then + echo ' first argument required.' + exit 1; +fi; +zone='string:'"$1"; +shift; +servers=''; +if [ $# -gt 0 ]; then + for svr in $*; do + servers="$servers string:$svr"; + done +fi; +dbus-send --system --type=method_call --print-reply --reply-timeout=20000 --dest=com.redhat.named /com/redhat/named com.redhat.named.text.SetForwarders $zone $type $servers; -- cgit