579. [bug] nsupdate did not take a filename to read update from.

[RT #492]
This commit is contained in:
Mark Andrews
2000-11-27 00:43:33 +00:00
parent 07892e4443
commit 517950ae99
4 changed files with 32 additions and 7 deletions

View File

@@ -1,3 +1,6 @@
579. [bug] nsupdate did not take a filename to read update from.
[RT #492]
578. [func] Notify-source, specify the source address for notify
messages.

View File

@@ -13,7 +13,7 @@
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" $Id: nsupdate.8,v 1.9 2000/11/18 02:57:30 bwelling Exp $
.\" $Id: nsupdate.8,v 1.10 2000/11/27 00:43:33 marka Exp $
.Dd Jun 30, 2000
.Dt NSUPDATE 8
@@ -30,6 +30,7 @@
.Fl k Ar keyfile
.Oc
.Op Fl v
.Op filename
.Sh DESCRIPTION
.Nm nsupdate
is used to submit Dynamic DNS Update requests as defined in RFC2136
@@ -130,7 +131,9 @@ use a TCP connection.
This may be preferable when a batch of update requests is made.
.Sh INPUT FORMAT
.Nm nsupdate
reads commands from its standard input.
reads input from
.Ar filename
or standard input.
Each command is supplied on exactly one line of input.
Some commands are for administrative purposes.
The others are either update instructions or prerequisite checks on the

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nsupdate.c,v 1.65 2000/11/22 21:59:50 bwelling Exp $ */
/* $Id: nsupdate.c,v 1.66 2000/11/27 00:43:32 marka Exp $ */
#include <config.h>
@@ -41,6 +41,7 @@ extern int h_errno;
#include <isc/region.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
@@ -115,6 +116,7 @@ static isc_sockaddr_t *localaddr = NULL;
static char *keystr = NULL, *keyfile = NULL;
static isc_entropy_t *entp = NULL;
static isc_boolean_t shuttingdown = ISC_FALSE;
static FILE *input;
typedef struct nsu_requestinfo {
dns_message_t *msg;
@@ -528,6 +530,7 @@ get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
static void
parse_args(int argc, char **argv) {
int ch;
isc_result_t result;
debug("parse_args");
while ((ch = isc_commandline_parse(argc, argv, "dDMy:vk:")) != -1) {
@@ -568,6 +571,17 @@ parse_args(int argc, char **argv) {
argv[0]);
exit(1);
}
if (argv[isc_commandline_index] != NULL) {
result = isc_stdio_open(argv[isc_commandline_index], "r",
&input);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "isc_stdio_open(%s): %s\n",
argv[isc_commandline_index],
isc_result_totext(result));
exit(1);
}
}
}
static isc_uint16_t
@@ -1107,12 +1121,12 @@ get_next_command(void) {
ddebug("get_next_command()");
fprintf(stdout, "> ");
cmdline = fgets(cmdlinebuf, MAXCMD, stdin);
cmdline = fgets(cmdlinebuf, MAXCMD, input);
if (cmdline == NULL)
return (STATUS_QUIT);
word = nsu_strsep(&cmdline, " \t\r\n");
if (feof(stdin))
if (feof(input))
return (STATUS_QUIT);
if (*word == 0)
return (STATUS_SEND);
@@ -1577,6 +1591,8 @@ int
main(int argc, char **argv) {
isc_result_t result;
input = stdin;
isc_app_start();
parse_args(argc, argv);

View File

@@ -13,7 +13,7 @@
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" $Id: nsupdate.8,v 1.9 2000/11/18 02:57:30 bwelling Exp $
.\" $Id: nsupdate.8,v 1.10 2000/11/27 00:43:33 marka Exp $
.Dd Jun 30, 2000
.Dt NSUPDATE 8
@@ -30,6 +30,7 @@
.Fl k Ar keyfile
.Oc
.Op Fl v
.Op filename
.Sh DESCRIPTION
.Nm nsupdate
is used to submit Dynamic DNS Update requests as defined in RFC2136
@@ -130,7 +131,9 @@ use a TCP connection.
This may be preferable when a batch of update requests is made.
.Sh INPUT FORMAT
.Nm nsupdate
reads commands from its standard input.
reads input from
.Ar filename
or standard input.
Each command is supplied on exactly one line of input.
Some commands are for administrative purposes.
The others are either update instructions or prerequisite checks on the