diff options
author | Marek Vavrusa <marek.vavrusa@nic.cz> | 2013-05-23 19:34:28 +0200 |
---|---|---|
committer | Marek Vavrusa <marek.vavrusa@nic.cz> | 2013-05-23 19:34:28 +0200 |
commit | 64dcadba8615ad25f324c2fba245060fae9fe37c (patch) | |
tree | 31a80ec26f0a1322ba33547a1cb64ab79d4de9c4 | |
parent | kdig: change default RRSIG expiration as YYYYMMDDHHmmSS (diff) | |
download | knot-64dcadba8615ad25f324c2fba245060fae9fe37c.tar.xz knot-64dcadba8615ad25f324c2fba245060fae9fe37c.zip |
knotc flush was broken without parameters, added an empty RR
fixes #2450, refs #2476
Change-Id: I5437f5cdf25a67a457fddc4582e17a99f25fe6f6
-rw-r--r-- | src/knot/ctl/knotc_main.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/knot/ctl/knotc_main.c b/src/knot/ctl/knotc_main.c index 5ddc20d48..a85081cfa 100644 --- a/src/knot/ctl/knotc_main.c +++ b/src/knot/ctl/knotc_main.c @@ -217,19 +217,23 @@ static int cmd_remote(const char *cmd, uint16_t rrt, int argc, char *argv[]) } /* Build query data. */ - knot_rrset_t *rr = remote_build_rr("data.", rrt); - for (int i = 0; i < argc; ++i) { - switch(rrt) { - case KNOT_RRTYPE_NS: - remote_create_ns(rr, argv[i]); - break; - case KNOT_RRTYPE_TXT: - default: - remote_create_txt(rr, argv[i], strlen(argv[i])); - break; + knot_rrset_t *rr = NULL; + if (argc > 0) { + rr = remote_build_rr("data.", rrt); + for (int i = 0; i < argc; ++i) { + switch(rrt) { + case KNOT_RRTYPE_NS: + remote_create_ns(rr, argv[i]); + break; + case KNOT_RRTYPE_TXT: + default: + remote_create_txt(rr, argv[i], strlen(argv[i])); + break; + } } + remote_query_append(qr, rr); } - remote_query_append(qr, rr); + if (knot_packet_to_wire(qr, &buf, &buflen) != KNOT_EOK) { knot_rrset_deep_free(&rr, 1, 1); knot_packet_free(&qr); |