Commit c03bb27f authored by Mark Andrews's avatar Mark Andrews
Browse files

532. [func] Implement DNS UPDATE pseudo records using

                        DNS_RDATA_UPDATE flag.

 531.   [func]          Rdata really should be initalized before being
                        assigned to (dns_rdata_fromwire(), dns_rdata_fromtext(),
                        dns_rdata_clone(), dns_rdata_fromregion()),
                        check that it is.
parent f9e24829
532. [func] Implement DNS UPDATE pseudo records using
DNS_RDATA_UPDATE flag.
531. [func] Rdata really should be initalized before being
assigned to (dns_rdata_fromwire(), dns_rdata_fromtext(),
dns_rdata_clone(), dns_rdata_fromregion()),
check that it is.
530. [func] New function dns_rdata_invalidate().
529. [bug] 521 contained a bug which caused zones to always
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dig.c,v 1.122 2000/10/23 23:13:16 mws Exp $ */
/* $Id: dig.c,v 1.123 2000/10/25 04:26:12 marka Exp $ */
#include <config.h>
#include <stdlib.h>
......@@ -287,7 +287,7 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags,
isc_result_t result, loopresult;
dns_name_t empty_name;
char t[4096];
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
UNUSED(flags);
......@@ -314,6 +314,7 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags,
buf);
check_result(result, "say_message");
loopresult = dns_rdataset_next(rdataset);
dns_rdata_invalidate(&rdata);
}
}
result = dns_message_nextname(msg, DNS_SECTION_ANSWER);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dighost.c,v 1.157 2000/10/23 23:13:17 mws Exp $ */
/* $Id: dighost.c,v 1.158 2000/10/25 04:26:13 marka Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
......@@ -1001,7 +1001,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query,
dig_lookup_t *lookup = NULL;
dig_server_t *srv = NULL;
dns_rdataset_t *rdataset = NULL;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_name_t *name = NULL;
isc_result_t result, loopresult;
isc_buffer_t *b = NULL;
......@@ -1093,6 +1093,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query,
srv, link);
isc_buffer_free(&b);
}
dns_rdata_invalidate(&rdata);
loopresult = dns_rdataset_next(rdataset);
}
}
......@@ -2070,7 +2071,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
isc_socketevent_t *sevent)
{
dns_rdataset_t *rdataset = NULL;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_rdata_soa_t soa;
isc_result_t result;
isc_buffer_t b;
......@@ -2109,6 +2110,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
query->rr_count++;
if (query->rr_count >= rr_limit)
atlimit = ISC_TRUE;
dns_rdata_invalidate(&rdata);
dns_rdataset_current(rdataset, &rdata);
/*
* If this is the first rr, make sure
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: host.c,v 1.57 2000/10/23 23:13:19 mws Exp $ */
/* $Id: host.c,v 1.58 2000/10/25 04:26:14 marka Exp $ */
#include <config.h>
#include <stdlib.h>
......@@ -288,7 +288,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
{
dns_name_t *name, *print_name;
dns_rdataset_t *rdataset;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
isc_buffer_t target;
isc_result_t result, loopresult;
isc_region_t r;
......@@ -355,6 +355,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
rtt = "unknown";
say_message(print_name, rtt,
&rdata, query);
dns_rdata_invalidate(&rdata);
loopresult =
dns_rdataset_next(rdataset);
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nslookup.c,v 1.60 2000/10/23 23:13:20 mws Exp $ */
/* $Id: nslookup.c,v 1.61 2000/10/25 04:26:16 marka Exp $ */
#include <config.h>
......@@ -194,7 +194,7 @@ printsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers,
isc_buffer_t *b = NULL;
dns_name_t *name;
dns_rdataset_t *rdataset = NULL;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
char *ptr;
char *input;
......@@ -327,6 +327,7 @@ printsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers,
(int)isc_buffer_usedlength(b),
(char*)isc_buffer_base(b));
}
dns_rdata_invalidate(&rdata);
loopresult = dns_rdataset_next(rdataset);
}
}
......@@ -349,7 +350,7 @@ detailsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers,
isc_buffer_t *b = NULL;
dns_name_t *name;
dns_rdataset_t *rdataset = NULL;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
char *ptr;
char *input;
......@@ -466,6 +467,7 @@ detailsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers,
(int)isc_buffer_usedlength(b),
(char*)isc_buffer_base(b));
}
dns_rdata_invalidate(&rdata);
loopresult = dns_rdataset_next(rdataset);
}
}
......
......@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signkey.c,v 1.39 2000/10/20 02:21:35 marka Exp $ */
/* $Id: dnssec-signkey.c,v 1.40 2000/10/25 04:26:17 marka Exp $ */
#include <config.h>
......@@ -97,7 +97,7 @@ usage(void) {
static void
loadkeys(dns_name_t *name, dns_rdataset_t *rdataset) {
dst_key_t *key;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
keynode_t *keynode;
isc_result_t result;
......@@ -105,6 +105,7 @@ loadkeys(dns_name_t *name, dns_rdataset_t *rdataset) {
result = dns_rdataset_first(rdataset);
check_result(result, "dns_rdataset_first");
for (; result == ISC_R_SUCCESS; result = dns_rdataset_next(rdataset)) {
dns_rdata_invalidate(&rdata);
dns_rdataset_current(rdataset, &rdata);
key = NULL;
result = dns_dnssec_keyfromrdata(name, &rdata, mctx, &key);
......@@ -155,7 +156,8 @@ main(int argc, char *argv[]) {
dns_dbnode_t *node;
dns_dbversion_t *version;
dst_key_t *key = NULL;
dns_rdata_t *rdata, sigrdata;
dns_rdata_t *rdata;
dns_rdata_t sigrdata = DNS_RDATA_INIT;
dns_rdatalist_t sigrdatalist;
dns_rdataset_t rdataset, sigrdataset, newsigrdataset;
dns_rdata_sig_t sig;
......@@ -319,6 +321,7 @@ main(int argc, char *argv[]) {
fatal("signature by key '%s' did not verify: %s",
keystr, isc_result_totext(result));
}
dns_rdata_invalidate(&sigrdata);
dns_rdata_freestruct(&sig);
result = dns_rdataset_next(&sigrdataset);
} while (result == ISC_R_SUCCESS);
......@@ -370,7 +373,6 @@ main(int argc, char *argv[]) {
data = isc_mem_get(mctx, BUFSIZE);
if (data == NULL)
fatal("out of memory");
dns_rdata_init(rdata);
isc_buffer_init(&b, data, BUFSIZE);
result = dns_dnssec_sign(domain, &rdataset, key,
&starttime, &endtime,
......
......@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signzone.c,v 1.102 2000/10/20 02:21:36 marka Exp $ */
/* $Id: dnssec-signzone.c,v 1.103 2000/10/25 04:26:18 marka Exp $ */
#include <config.h>
......@@ -99,7 +99,6 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dns_rdata_t *rdata,
{
isc_result_t result;
dns_rdata_init(rdata);
result = dns_dnssec_sign(name, rdataset, key, &starttime, &endtime,
mctx, b, rdata);
isc_entropy_stopcallbacksources(ectx);
......@@ -170,7 +169,7 @@ keythatsigned(dns_rdata_sig_t *sig) {
key->key = pubkey;
key->isdefault = ISC_FALSE;
key->position = keycount++;
ISC_LIST_APPEND(keylist, key, link);
ISC_LIST_APPENDUNSAFE(keylist, key, link);
return key;
}
......@@ -224,7 +223,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
dns_dbnode_t *node, dns_name_t *name, dns_rdataset_t *set)
{
dns_rdataset_t sigset;
dns_rdata_t sigrdata;
dns_rdata_t sigrdata = DNS_RDATA_INIT;
dns_rdata_sig_t sig;
signer_key_t *key;
isc_result_t result;
......@@ -355,7 +354,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
if (resign) {
isc_buffer_t b;
dns_rdata_t trdata;
dns_rdata_t trdata = DNS_RDATA_INIT;
unsigned char array[BUFSIZE];
char keystr[KEY_FORMATSIZE];
......@@ -372,6 +371,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
dns_diff_append(diff, &tuple);
}
dns_rdata_invalidate(&sigrdata);
dns_rdata_freestruct(&sig);
result = dns_rdataset_next(&sigset);
}
......@@ -386,7 +386,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_diff_t *diff,
while (key != NULL) {
if (key->isdefault && !nowsignedby[key->position]) {
isc_buffer_t b;
dns_rdata_t trdata;
dns_rdata_t trdata = DNS_RDATA_INIT;
unsigned char array[BUFSIZE];
char keystr[KEY_FORMATSIZE];
......@@ -419,6 +419,7 @@ hasnullkey(dns_rdataset_t *rdataset) {
while (result == ISC_R_SUCCESS) {
dst_key_t *key = NULL;
dns_rdata_init(&rdata);
dns_rdataset_current(rdataset, &rdata);
result = dns_dnssec_keyfromrdata(dns_rootname,
&rdata, mctx, &key);
......@@ -562,7 +563,7 @@ haschildkey(dns_db_t *db, dns_name_t *name) {
dns_db_t *newdb = NULL;
dns_dbnode_t *newnode = NULL;
dns_rdataset_t set, sigset;
dns_rdata_t sigrdata;
dns_rdata_t sigrdata = DNS_RDATA_INIT;
isc_result_t result;
isc_boolean_t found = ISC_FALSE;
dns_rdata_sig_t sig;
......@@ -605,6 +606,7 @@ haschildkey(dns_db_t *db, dns_name_t *name) {
found = ISC_TRUE;
break;
}
dns_rdata_invalidate(&sigrdata);
}
failure:
......@@ -631,7 +633,7 @@ nxt_setbit(dns_rdataset_t *rdataset, dns_rdatatype_t type) {
dns_name_t nxtname;
isc_region_t r, r2;
isc_result_t result;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
result = dns_rdataset_first(rdataset);
check_result(result, "dns_rdataset_first()");
......@@ -647,7 +649,7 @@ nxt_setbit(dns_rdataset_t *rdataset, dns_rdatatype_t type) {
static void
createnullkey(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name) {
unsigned char keydata[4];
dns_rdata_t keyrdata;
dns_rdata_t keyrdata = DNS_RDATA_INIT;
dns_rdata_key_t key;
dns_diff_t diff;
dns_difftuple_t *tuple = NULL;
......@@ -938,7 +940,7 @@ minimumttl(dns_db_t *db, dns_dbversion_t *version) {
dns_name_t *origin;
dns_fixedname_t fname;
dns_name_t *name;
dns_rdata_t soarr;
dns_rdata_t soarr = DNS_RDATA_INIT;
dns_rdata_soa_t soa;
isc_result_t result;
dns_ttl_t ttl;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: client.c,v 1.122 2000/10/18 22:10:20 gson Exp $ */
/* $Id: client.c,v 1.123 2000/10/25 04:26:19 marka Exp $ */
#include <config.h>
......@@ -1010,6 +1010,7 @@ client_addopt(ns_client_t *client) {
rdata->length = 0;
rdata->rdclass = rdatalist->rdclass;
rdata->type = rdatalist->type;
rdata->flags = 0;
#ifdef DNS_OPT_NEWCODES
/*
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: query.c,v 1.139 2000/10/20 02:21:39 marka Exp $ */
/* $Id: query.c,v 1.140 2000/10/25 04:26:21 marka Exp $ */
#include <config.h>
......@@ -1565,7 +1565,7 @@ query_addsoa(ns_client_t *client, dns_db_t *db, isc_boolean_t zero_ttl) {
* Extract the SOA MINIMUM.
*/
dns_rdata_soa_t soa;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
result = dns_rdataset_first(rdataset);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
dns_rdataset_current(rdataset, &rdata);
......@@ -2139,7 +2139,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
dns_name_t *fname, *zfname, *tname, *prefix;
dns_rdataset_t *rdataset, *trdataset;
dns_rdataset_t *sigrdataset, *zrdataset, *zsigrdataset;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_rdatasetiter_t *rdsiter;
isc_boolean_t want_restart, authoritative, is_zone;
unsigned int qcount, n, nlabels, nbits;
......@@ -2728,6 +2728,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
goto cleanup;
dns_rdataset_current(trdataset, &rdata);
result = dns_rdata_tostruct(&rdata, &cname, NULL);
dns_rdata_invalidate(&rdata);
if (result != ISC_R_SUCCESS)
goto cleanup;
dns_name_init(tname, NULL);
......@@ -2774,6 +2775,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
goto cleanup;
dns_rdataset_current(trdataset, &rdata);
result = dns_rdata_tostruct(&rdata, &dname, NULL);
dns_rdata_invalidate(&rdata);
if (result != ISC_R_SUCCESS)
goto cleanup;
dns_name_init(tname, NULL);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.231 2000/10/18 22:13:48 bwelling Exp $ */
/* $Id: server.c,v 1.232 2000/10/25 04:26:22 marka Exp $ */
#include <config.h>
......@@ -727,7 +727,7 @@ create_version_zone(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr, dns_view_t *view)
unsigned char buf[256];
isc_region_t r;
size_t len;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
static unsigned char origindata[] = "\007version\004bind";
dns_name_t origin;
......@@ -810,7 +810,7 @@ create_authors_zone(dns_zonemgr_t *zmgr, dns_view_t *view) {
dns_diff_t diff;
isc_constregion_t r;
isc_constregion_t cr;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
static const char origindata[] = "\007authors\004bind";
dns_name_t origin;
int i;
......@@ -856,6 +856,7 @@ create_authors_zone(dns_zonemgr_t *zmgr, dns_view_t *view) {
CHECK(dns_difftuple_create(ns_g_mctx, DNS_DIFFOP_ADD, &origin,
0, &rdata, &tuple));
dns_diff_append(&diff, &tuple);
dns_rdata_invalidate(&rdata);
}
CHECK(dns_diff_apply(&diff, db, dbver));
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: update.c,v 1.69 2000/10/20 22:34:50 gson Exp $ */
/* $Id: update.c,v 1.70 2000/10/25 04:26:23 marka Exp $ */
#include <config.h>
......@@ -266,7 +266,8 @@ foreach_node_rr_action(void *data, dns_rdataset_t *rdataset) {
result == ISC_R_SUCCESS;
result = dns_rdataset_next(rdataset))
{
rr_t rr;
rr_t rr = { 0, DNS_RDATA_INIT };
dns_rdataset_current(rdataset, &rr.rdata);
rr.ttl = rdataset->ttl;
result = (*ctx->rr_action)(ctx->rr_action_data, &rr);
......@@ -407,7 +408,7 @@ foreach_rr(dns_db_t *db,
result == ISC_R_SUCCESS;
result = dns_rdataset_next(&rdataset))
{
rr_t rr;
rr_t rr = { 0, DNS_RDATA_INIT };
dns_rdataset_current(&rdataset, &rr.rdata);
rr.ttl = rdataset.ttl;
result = (*rr_action)(rr_action_data, &rr);
......@@ -807,7 +808,7 @@ temp_check(isc_mem_t *mctx, dns_diff_t *temp, dns_db_t *db,
result == ISC_R_SUCCESS;
result = dns_rdataset_next(&rdataset))
{
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_rdataset_current(&rdataset, &rdata);
result = temp_append(&d_rrs, name, &rdata);
if (result != ISC_R_SUCCESS)
......@@ -1144,7 +1145,8 @@ static isc_result_t
namelist_append_name(dns_diff_t *list, dns_name_t *name) {
isc_result_t result;
dns_difftuple_t *tuple = NULL;
static dns_rdata_t dummy_rdata = { NULL, 0, 0, 0, 0, { NULL, NULL } };
static dns_rdata_t dummy_rdata = { NULL, 0, 0, 0, 0,
{ (void*)(-1), (void*)(-1) } };
CHECK(dns_difftuple_create(list->mctx, DNS_DIFFOP_EXISTS, name, 0,
&dummy_rdata, &tuple));
dns_diff_append(list, &tuple);
......@@ -1344,7 +1346,7 @@ add_nxt(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_diff_t *diff)
isc_result_t result;
dns_dbnode_t *node = NULL;
unsigned char buffer[DNS_NXT_BUFFERSIZE];
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_difftuple_t *tuple = NULL;
dns_fixedname_t fixedname;
dns_name_t *target;
......@@ -1391,7 +1393,7 @@ add_placeholder_nxt(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name,
dns_difftuple_t *tuple = NULL;
isc_region_t r;
unsigned char data[1] = { 0 }; /* The root domain, no bits. */
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
r.base = data;
r.length = sizeof data;
......@@ -1430,7 +1432,7 @@ add_sigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name,
isc_result_t result;
dns_dbnode_t *node = NULL;
dns_rdataset_t rdataset;
dns_rdata_t sig_rdata;
dns_rdata_t sig_rdata = DNS_RDATA_INIT;
isc_buffer_t buffer;
unsigned char data[1024]; /* XXX */
unsigned int i;
......@@ -1455,6 +1457,7 @@ add_sigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name,
/* XXX inefficient - will cause dataset merging */
CHECK(update_one_rr(db, ver, diff, DNS_DIFFOP_ADD, name,
rdataset.ttl, &sig_rdata));
dns_rdata_invalidate(&sig_rdata);
}
failure:
......@@ -1951,7 +1954,7 @@ update_action(isc_task_t *task, isc_event_t *event) {
result = dns_message_nextname(request, DNS_SECTION_PREREQUISITE))
{
dns_name_t *name = NULL;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_ttl_t ttl;
dns_rdataclass_t update_class;
isc_boolean_t flag;
......@@ -2060,7 +2063,7 @@ update_action(isc_task_t *task, isc_event_t *event) {
result = dns_message_nextname(request, DNS_SECTION_UPDATE))
{
dns_name_t *name = NULL;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_ttl_t ttl;
dns_rdataclass_t update_class;
get_current_rr(request, DNS_SECTION_UPDATE, zoneclass,
......@@ -2145,7 +2148,7 @@ update_action(isc_task_t *task, isc_event_t *event) {
result = dns_message_nextname(request, DNS_SECTION_UPDATE))
{
dns_name_t *name = NULL;
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_ttl_t ttl;
dns_rdataclass_t update_class;
isc_boolean_t flag;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: xfrout.c,v 1.78 2000/10/20 13:29:30 marka Exp $ */
/* $Id: xfrout.c,v 1.79 2000/10/25 04:26:25 marka Exp $ */
#include <config.h>
......@@ -138,6 +138,7 @@ db_rr_iterator_init(db_rr_iterator_t *it, dns_db_t *db, dns_dbversion_t *ver,
if (result != ISC_R_SUCCESS)
return (result);
it->rdatasetit = NULL;
dns_rdata_init(&it->rdata);
dns_rdataset_init(&it->rdataset);
dns_fixedname_init(&it->fixedname);
INSIST(! dns_rdataset_isassociated(&it->rdataset));
......@@ -240,6 +241,7 @@ db_rr_iterator_current(db_rr_iterator_t *it, dns_name_t **name,
REQUIRE(it->result == ISC_R_SUCCESS);
*name = dns_fixedname_name(&it->fixedname);
*ttl = it->rdataset.ttl;
dns_rdata_invalidate(&it->rdata);
dns_rdataset_current(&it->rdataset, &it->rdata);
*rdata = &it->rdata;
}
......@@ -816,7 +818,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
dns_difftuple_t *current_soa_tuple = NULL;
dns_name_t *soa_name;
dns_rdataset_t *soa_rdataset;
dns_rdata_t soa_rdata;
dns_rdata_t soa_rdata = DNS_RDATA_INIT;
isc_boolean_t have_soa = ISC_FALSE;
const char *mnemonic = NULL;
isc_mem_t *mctx = client->mctx;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nsupdate.c,v 1.57 2000/10/20 18:31:27 gson Exp $ */
/* $Id: nsupdate.c,v 1.58 2000/10/25 04:26:26 marka Exp $ */
#include <config.h>
......@@ -585,7 +585,7 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
static isc_uint16_t
parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
dns_rdatatype_t rdatatype, dns_message_t *msg,
dns_rdata_t **rdatap)
dns_rdata_t *rdata)
{
char *cmdline = *cmdlinep;
isc_buffer_t source, *buf = NULL;
......@@ -620,7 +620,7 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
}
result = isc_buffer_allocate(mctx, &buf, bufsz);
check_result(result, "isc_buffer_allocate");
result = dns_rdata_fromtext(*rdatap, rdataclass,
result = dns_rdata_fromtext(rdata, rdataclass,
rdatatype,
lex, rn, ISC_FALSE, buf,
&callbacks);
......@@ -631,6 +631,8 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
dns_message_takebuffer(msg, &buf);
if (result != ISC_R_SUCCESS)
return (STATUS_MORE);
} else {
rdata->flags = DNS_RDATA_UPDATE;
}
*cmdlinep = cmdline;
return (STATUS_MORE);
......@@ -701,7 +703,7 @@ make_prereq(char *cmdline, isc_boolean_t ispositive, isc_boolean_t isrrset) {
if (isrrset && ispositive) {
retval = parse_rdata(&cmdline, rdataclass, rdatatype,
updatemsg, &rdata);
updatemsg, rdata);
if (retval != STATUS_MORE)
return (retval);
}
......@@ -895,6 +897,7 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) {
if (isdelete) {
rdataclass = dns_rdataclass_any;
rdatatype = dns_rdatatype_any;
rdata->flags = DNS_RDATA_UPDATE;
goto doneparsing;
} else {
fprintf(stderr, "failed to read class or type\n");
......@@ -913,6 +916,7 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) {
if (isdelete) {
rdataclass = dns_rdataclass_any;
rdatatype = dns_rdatatype_any;
rdata->flags = DNS_RDATA_UPDATE;
goto doneparsing;
} else {
fprintf(stderr, "failed to read type\n");
......@@ -930,17 +934,17 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) {
}
retval = parse_rdata(&cmdline, rdataclass, rdatatype, updatemsg,
&rdata);
rdata);
if (retval != STATUS_MORE)
goto failure;
if (isdelete) {
if (rdata->length == 0)
if ((rdata->flags & DNS_RDATA_UPDATE) != 0)
rdataclass = dns_rdataclass_any;
else
rdataclass = dns_rdataclass_none;
} else {
if (rdata->length == 0) {
if ((rdata->flags & DNS_RDATA_UPDATE) != 0) {
fprintf(stderr, "failed to read rdata\n");
goto failure;
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: a6.c,v 1.16 2000/08/01 01:22:06 tale Exp $ */
/* $Id: a6.c,v 1.17 2000/10/25 04:26:27 marka Exp $ */
#include <config.h>
......@@ -42,7 +42,7 @@ static isc_result_t
foreach(dns_a6context_t *a6ctx, dns_rdataset_t *parent, unsigned int depth,
unsigned int oprefixlen)
{
dns_rdata_t rdata;
dns_rdata_t rdata = DNS_RDATA_INIT;
isc_region_t r;
dns_name_t name;
dns_rdataset_t child;
......@@ -152,6 +152,7 @@ foreach(dns_a6context_t *a6ctx, dns_rdataset_t *parent, unsigned int depth,
(a6ctx->