diff options
Diffstat (limited to 'contrib/bind9/bin/nsupdate')
-rw-r--r-- | contrib/bind9/bin/nsupdate/Makefile.in | 6 | ||||
-rw-r--r-- | contrib/bind9/bin/nsupdate/nsupdate.1 | 18 | ||||
-rw-r--r-- | contrib/bind9/bin/nsupdate/nsupdate.c | 97 | ||||
-rw-r--r-- | contrib/bind9/bin/nsupdate/nsupdate.docbook | 20 | ||||
-rw-r--r-- | contrib/bind9/bin/nsupdate/nsupdate.html | 28 |
5 files changed, 104 insertions, 65 deletions
diff --git a/contrib/bind9/bin/nsupdate/Makefile.in b/contrib/bind9/bin/nsupdate/Makefile.in index f62ee34..09e6c14 100644 --- a/contrib/bind9/bin/nsupdate/Makefile.in +++ b/contrib/bind9/bin/nsupdate/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2006-2009, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2006-2009, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2000-2002 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -23,6 +23,8 @@ top_srcdir = @top_srcdir@ @BIND9_MAKE_INCLUDES@ +READLINE_LIB = @READLINE_LIB@ + CINCLUDES = ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \ ${ISC_INCLUDES} ${ISCCFG_INCLUDES} @DST_GSSAPI_INC@ @@ -72,7 +74,7 @@ nsupdate.@O@: nsupdate.c -c ${srcdir}/nsupdate.c nsupdate@EXEEXT@: nsupdate.@O@ ${UOBJS} ${DEPLIBS} - export BASEOBJS="nsupdate.@O@ ${UOBJS}"; \ + export BASEOBJS="nsupdate.@O@ ${READLINE_LIB} ${UOBJS}"; \ ${FINALBUILDCMD} doc man:: ${MANOBJS} diff --git a/contrib/bind9/bin/nsupdate/nsupdate.1 b/contrib/bind9/bin/nsupdate/nsupdate.1 index 5867597..1e2dcaf 100644 --- a/contrib/bind9/bin/nsupdate/nsupdate.1 +++ b/contrib/bind9/bin/nsupdate/nsupdate.1 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000-2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -263,20 +263,20 @@ rather than the default realm in \fIkrb5.conf\fR. If no realm is specified the saved realm is cleared. .RE .PP -\fBprereq nxdomain\fR {domain\-name} +\fB[prereq]\fR\fB nxdomain\fR {domain\-name} .RS 4 Requires that no resource record of any type exists with name \fIdomain\-name\fR. .RE .PP -\fBprereq yxdomain\fR {domain\-name} +\fB[prereq]\fR\fB yxdomain\fR {domain\-name} .RS 4 Requires that \fIdomain\-name\fR exists (has as at least one resource record, of any type). .RE .PP -\fBprereq nxrrset\fR {domain\-name} [class] {type} +\fB[prereq]\fR\fB nxrrset\fR {domain\-name} [class] {type} .RS 4 Requires that no resource record exists of the specified \fItype\fR, @@ -287,7 +287,7 @@ and is omitted, IN (internet) is assumed. .RE .PP -\fBprereq yxrrset\fR {domain\-name} [class] {type} +\fB[prereq]\fR\fB yxrrset\fR {domain\-name} [class] {type} .RS 4 This requires that a resource record of the specified \fItype\fR, @@ -299,7 +299,7 @@ must exist. If is omitted, IN (internet) is assumed. .RE .PP -\fBprereq yxrrset\fR {domain\-name} [class] {type} {data...} +\fB[prereq]\fR\fB yxrrset\fR {domain\-name} [class] {type} {data...} .RS 4 The \fIdata\fR @@ -315,7 +315,7 @@ are combined to form a set of RRs. This set of RRs must exactly match the set of are written in the standard text representation of the resource record's RDATA. .RE .PP -\fBupdate delete\fR {domain\-name} [ttl] [class] [type\ [data...]] +\fB[update]\fR\fB del\fR\fB[ete]\fR {domain\-name} [ttl] [class] [type\ [data...]] .RS 4 Deletes any resource records named \fIdomain\-name\fR. If @@ -329,7 +329,7 @@ is not supplied. The is ignored, and is only allowed for compatibility. .RE .PP -\fBupdate add\fR {domain\-name} {ttl} [class] {type} {data...} +\fB[update]\fR\fB add\fR {domain\-name} {ttl} [class] {type} {data...} .RS 4 Adds a new resource record with the specified \fIttl\fR, @@ -435,7 +435,7 @@ RFC 2931, .PP The TSIG key is redundantly stored in two separate files. This is a consequence of nsupdate using the DST library for its cryptographic operations, and may change in future releases. .SH "COPYRIGHT" -Copyright \(co 2004\-2010 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004\-2012 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000\-2003 Internet Software Consortium. .br diff --git a/contrib/bind9/bin/nsupdate/nsupdate.c b/contrib/bind9/bin/nsupdate/nsupdate.c index e11f080..e96c075 100644 --- a/contrib/bind9/bin/nsupdate/nsupdate.c +++ b/contrib/bind9/bin/nsupdate/nsupdate.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsupdate.c,v 1.193.12.4 2011/11/03 04:30:09 each Exp $ */ +/* $Id$ */ /*! \file */ @@ -85,6 +85,10 @@ #endif #include <bind9/getaddresses.h> +#if defined(HAVE_READLINE) +#include <readline/readline.h> +#include <readline/history.h> +#endif #ifdef HAVE_ADDRINFO #ifdef HAVE_GETADDRINFO @@ -1805,6 +1809,8 @@ evaluate_update(char *cmdline) { } if (strcasecmp(word, "delete") == 0) isdelete = ISC_TRUE; + else if (strcasecmp(word, "del") == 0) + isdelete = ISC_TRUE; else if (strcasecmp(word, "add") == 0) isdelete = ISC_FALSE; else { @@ -1883,35 +1889,13 @@ show_message(FILE *stream, dns_message_t *msg, const char *description) { isc_buffer_free(&buf); } - static isc_uint16_t -get_next_command(void) { - char cmdlinebuf[MAXCMD]; - char *cmdline; +do_next_command(char *cmdline) { char *word; - char *tmp; - - ddebug("get_next_command()"); - if (interactive) { - fprintf(stdout, "> "); - fflush(stdout); - } - isc_app_block(); - cmdline = fgets(cmdlinebuf, MAXCMD, input); - isc_app_unblock(); - if (cmdline == NULL) - return (STATUS_QUIT); - - /* - * Normalize input by removing any eol. - */ - tmp = cmdline; - (void)nsu_strsep(&tmp, "\r\n"); + ddebug("do_next_command()"); word = nsu_strsep(&cmdline, " \t\r\n"); - if (feof(input)) - return (STATUS_QUIT); if (word == NULL || *word == 0) return (STATUS_SEND); if (word[0] == ';') @@ -1920,8 +1904,22 @@ get_next_command(void) { return (STATUS_QUIT); if (strcasecmp(word, "prereq") == 0) return (evaluate_prereq(cmdline)); + if (strcasecmp(word, "nxdomain") == 0) + return (make_prereq(cmdline, ISC_FALSE, ISC_FALSE)); + if (strcasecmp(word, "yxdomain") == 0) + return (make_prereq(cmdline, ISC_TRUE, ISC_FALSE)); + if (strcasecmp(word, "nxrrset") == 0) + return (make_prereq(cmdline, ISC_FALSE, ISC_TRUE)); + if (strcasecmp(word, "yxrrset") == 0) + return (make_prereq(cmdline, ISC_TRUE, ISC_TRUE)); if (strcasecmp(word, "update") == 0) return (evaluate_update(cmdline)); + if (strcasecmp(word, "delete") == 0) + return (update_addordelete(cmdline, ISC_TRUE)); + if (strcasecmp(word, "del") == 0) + return (update_addordelete(cmdline, ISC_TRUE)); + if (strcasecmp(word, "add") == 0) + return (update_addordelete(cmdline, ISC_FALSE)); if (strcasecmp(word, "server") == 0) return (evaluate_server(cmdline)); if (strcasecmp(word, "local") == 0) @@ -1988,18 +1986,55 @@ get_next_command(void) { "oldgsstsig (use Microsoft's GSS_TSIG to sign the request)\n" "zone name (set the zone to be updated)\n" "class CLASS (set the zone's DNS class, e.g. IN (default), CH)\n" -"prereq nxdomain name (does this name not exist)\n" -"prereq yxdomain name (does this name exist)\n" -"prereq nxrrset .... (does this RRset exist)\n" -"prereq yxrrset .... (does this RRset not exist)\n" -"update add .... (add the given record to the zone)\n" -"update delete .... (remove the given record(s) from the zone)\n"); +"[prereq] nxdomain name (does this name not exist)\n" +"[prereq] yxdomain name (does this name exist)\n" +"[prereq] nxrrset .... (does this RRset exist)\n" +"[prereq] yxrrset .... (does this RRset not exist)\n" +"[update] add .... (add the given record to the zone)\n" +"[update] del[ete] .... (remove the given record(s) from the zone)\n"); return (STATUS_MORE); } fprintf(stderr, "incorrect section name: %s\n", word); return (STATUS_SYNTAX); } +static isc_uint16_t +get_next_command(void) { + isc_uint16_t result = STATUS_QUIT; + char cmdlinebuf[MAXCMD]; + char *cmdline; + + isc_app_block(); + if (interactive) { +#ifdef HAVE_READLINE + cmdline = readline("> "); + add_history(cmdline); +#else + fprintf(stdout, "> "); + fflush(stdout); + cmdline = fgets(cmdlinebuf, MAXCMD, input); +#endif + } else + cmdline = fgets(cmdlinebuf, MAXCMD, input); + isc_app_unblock(); + + if (cmdline != NULL) { + char *tmp = cmdline; + + /* + * Normalize input by removing any eol as readline() + * removes eol but fgets doesn't. + */ + (void)nsu_strsep(&tmp, "\r\n"); + result = do_next_command(cmdline); + } +#ifdef HAVE_READLINE + if (interactive) + free(cmdline); +#endif + return (result); +} + static isc_boolean_t user_interaction(void) { isc_uint16_t result = STATUS_MORE; diff --git a/contrib/bind9/bin/nsupdate/nsupdate.docbook b/contrib/bind9/bin/nsupdate/nsupdate.docbook index 6378df7..c54211c 100644 --- a/contrib/bind9/bin/nsupdate/nsupdate.docbook +++ b/contrib/bind9/bin/nsupdate/nsupdate.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000-2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,7 +18,7 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id: nsupdate.docbook,v 1.44 2010/07/09 23:46:51 tbox Exp $ --> +<!-- $Id$ --> <refentry id="man.nsupdate"> <refentryinfo> <date>Aug 25, 2009</date> @@ -42,6 +42,8 @@ <year>2008</year> <year>2009</year> <year>2010</year> + <year>2011</year> + <year>2012</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -424,7 +426,7 @@ <varlistentry> <term> - <command>prereq nxdomain</command> + <command><optional>prereq</optional> nxdomain</command> <arg choice="req">domain-name</arg> </term> <listitem> @@ -438,7 +440,7 @@ <varlistentry> <term> - <command>prereq yxdomain</command> + <command><optional>prereq</optional> yxdomain</command> <arg choice="req">domain-name</arg> </term> <listitem> @@ -452,7 +454,7 @@ <varlistentry> <term> - <command>prereq nxrrset</command> + <command><optional>prereq</optional> nxrrset</command> <arg choice="req">domain-name</arg> <arg choice="opt">class</arg> <arg choice="req">type</arg> @@ -474,7 +476,7 @@ <varlistentry> <term> - <command>prereq yxrrset</command> + <command><optional>prereq</optional> yxrrset</command> <arg choice="req">domain-name</arg> <arg choice="opt">class</arg> <arg choice="req">type</arg> @@ -496,7 +498,7 @@ <varlistentry> <term> - <command>prereq yxrrset</command> + <command><optional>prereq</optional> yxrrset</command> <arg choice="req">domain-name</arg> <arg choice="opt">class</arg> <arg choice="req">type</arg> @@ -530,7 +532,7 @@ <varlistentry> <term> - <command>update delete</command> + <command><optional>update</optional> del<optional>ete</optional></command> <arg choice="req">domain-name</arg> <arg choice="opt">ttl</arg> <arg choice="opt">class</arg> @@ -556,7 +558,7 @@ <varlistentry> <term> - <command>update add</command> + <command><optional>update</optional> add</command> <arg choice="req">domain-name</arg> <arg choice="req">ttl</arg> <arg choice="opt">class</arg> diff --git a/contrib/bind9/bin/nsupdate/nsupdate.html b/contrib/bind9/bin/nsupdate/nsupdate.html index 5c108e3..276d4af 100644 --- a/contrib/bind9/bin/nsupdate/nsupdate.html +++ b/contrib/bind9/bin/nsupdate/nsupdate.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000-2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -32,7 +32,7 @@ <div class="cmdsynopsis"><p><code class="command">nsupdate</code> [<code class="option">-d</code>] [<code class="option">-D</code>] [[<code class="option">-g</code>] | [<code class="option">-o</code>] | [<code class="option">-l</code>] | [<code class="option">-y <em class="replaceable"><code>[<span class="optional">hmac:</span>]keyname:secret</code></em></code>] | [<code class="option">-k <em class="replaceable"><code>keyfile</code></em></code>]] [<code class="option">-t <em class="replaceable"><code>timeout</code></em></code>] [<code class="option">-u <em class="replaceable"><code>udptimeout</code></em></code>] [<code class="option">-r <em class="replaceable"><code>udpretries</code></em></code>] [<code class="option">-R <em class="replaceable"><code>randomdev</code></em></code>] [<code class="option">-v</code>] [filename]</p></div> </div> <div class="refsect1" lang="en"> -<a name="id2543459"></a><h2>DESCRIPTION</h2> +<a name="id2543464"></a><h2>DESCRIPTION</h2> <p><span><strong class="command">nsupdate</strong></span> is used to submit Dynamic DNS Update requests as defined in RFC 2136 to a name server. @@ -192,7 +192,7 @@ </p> </div> <div class="refsect1" lang="en"> -<a name="id2543790"></a><h2>INPUT FORMAT</h2> +<a name="id2543796"></a><h2>INPUT FORMAT</h2> <p><span><strong class="command">nsupdate</strong></span> reads input from <em class="parameter"><code>filename</code></em> @@ -331,7 +331,7 @@ realm is specified the saved realm is cleared. </p></dd> <dt><span class="term"> - <span><strong class="command">prereq nxdomain</strong></span> + <span><strong class="command">[<span class="optional">prereq</span>] nxdomain</strong></span> {domain-name} </span></dt> <dd><p> @@ -339,7 +339,7 @@ <em class="parameter"><code>domain-name</code></em>. </p></dd> <dt><span class="term"> - <span><strong class="command">prereq yxdomain</strong></span> + <span><strong class="command">[<span class="optional">prereq</span>] yxdomain</strong></span> {domain-name} </span></dt> <dd><p> @@ -348,7 +348,7 @@ exists (has as at least one resource record, of any type). </p></dd> <dt><span class="term"> - <span><strong class="command">prereq nxrrset</strong></span> + <span><strong class="command">[<span class="optional">prereq</span>] nxrrset</strong></span> {domain-name} [class] {type} @@ -364,7 +364,7 @@ is omitted, IN (internet) is assumed. </p></dd> <dt><span class="term"> - <span><strong class="command">prereq yxrrset</strong></span> + <span><strong class="command">[<span class="optional">prereq</span>] yxrrset</strong></span> {domain-name} [class] {type} @@ -381,7 +381,7 @@ is omitted, IN (internet) is assumed. </p></dd> <dt><span class="term"> - <span><strong class="command">prereq yxrrset</strong></span> + <span><strong class="command">[<span class="optional">prereq</span>] yxrrset</strong></span> {domain-name} [class] {type} @@ -410,7 +410,7 @@ RDATA. </p></dd> <dt><span class="term"> - <span><strong class="command">update delete</strong></span> + <span><strong class="command">[<span class="optional">update</span>] del[<span class="optional">ete</span>]</strong></span> {domain-name} [ttl] [class] @@ -431,7 +431,7 @@ is ignored, and is only allowed for compatibility. </p></dd> <dt><span class="term"> - <span><strong class="command">update add</strong></span> + <span><strong class="command">[<span class="optional">update</span>] add</strong></span> {domain-name} {ttl} [class] @@ -480,7 +480,7 @@ </p> </div> <div class="refsect1" lang="en"> -<a name="id2544702"></a><h2>EXAMPLES</h2> +<a name="id2544725"></a><h2>EXAMPLES</h2> <p> The examples below show how <span><strong class="command">nsupdate</strong></span> @@ -534,7 +534,7 @@ </p> </div> <div class="refsect1" lang="en"> -<a name="id2544746"></a><h2>FILES</h2> +<a name="id2544769"></a><h2>FILES</h2> <div class="variablelist"><dl> <dt><span class="term"><code class="constant">/etc/resolv.conf</code></span></dt> <dd><p> @@ -557,7 +557,7 @@ </dl></div> </div> <div class="refsect1" lang="en"> -<a name="id2544829"></a><h2>SEE ALSO</h2> +<a name="id2542121"></a><h2>SEE ALSO</h2> <p> <em class="citetitle">RFC 2136</em>, <em class="citetitle">RFC 3007</em>, @@ -572,7 +572,7 @@ </p> </div> <div class="refsect1" lang="en"> -<a name="id2542156"></a><h2>BUGS</h2> +<a name="id2542179"></a><h2>BUGS</h2> <p> The TSIG key is redundantly stored in two separate files. This is a consequence of nsupdate using the DST library |