naptr_35.c 12.1 KB
Newer Older
Mark Andrews's avatar
Mark Andrews committed
1
/*
Bob Halley's avatar
Bob Halley committed
2
 * Copyright (C) 1999, 2000  Internet Software Consortium.
Mark Andrews's avatar
Mark Andrews committed
3 4 5 6 7
 * 
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 * 
8 9 10 11 12 13 14 15
 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
 * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
 * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Mark Andrews's avatar
Mark Andrews committed
16 17
 */

18
/* $Id: naptr_35.c,v 1.32 2000/07/27 09:50:07 tale Exp $ */
Mark Andrews's avatar
Mark Andrews committed
19

20 21 22
/* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */

/* RFC 2168 */
Mark Andrews's avatar
Mark Andrews committed
23

24 25
#ifndef RDATA_IN_1_NAPTR_35_C
#define RDATA_IN_1_NAPTR_35_C
Mark Andrews's avatar
Mark Andrews committed
26

27 28
#define RRTYPE_NAPTR_ATTRIBUTES (0)

29
static inline isc_result_t
David Lawrence's avatar
David Lawrence committed
30
fromtext_in_naptr(ARGS_FROMTEXT) {
Mark Andrews's avatar
Mark Andrews committed
31 32 33 34 35
	isc_token_t token;
	dns_name_t name;
	isc_buffer_t buffer;

	REQUIRE(type == 35);
36
	REQUIRE(rdclass == 1);
Mark Andrews's avatar
Mark Andrews committed
37

David Lawrence's avatar
David Lawrence committed
38 39 40
	/*
	 * Order.
	 */
Mark Andrews's avatar
Mark Andrews committed
41
	RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE));
42
	if (token.value.as_ulong > 0xffff)
David Lawrence's avatar
David Lawrence committed
43
		return (ISC_R_RANGE);
Mark Andrews's avatar
Mark Andrews committed
44 45
	RETERR(uint16_tobuffer(token.value.as_ulong, target));

David Lawrence's avatar
David Lawrence committed
46 47 48
	/*
	 * Preference.
	 */
Mark Andrews's avatar
Mark Andrews committed
49
	RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE));
50
	if (token.value.as_ulong > 0xffff)
David Lawrence's avatar
David Lawrence committed
51
		return (ISC_R_RANGE);
Mark Andrews's avatar
Mark Andrews committed
52 53
	RETERR(uint16_tobuffer(token.value.as_ulong, target));

David Lawrence's avatar
David Lawrence committed
54 55 56
	/*
	 * Flags.
	 */
Mark Andrews's avatar
Mark Andrews committed
57 58 59
	RETERR(gettoken(lexer, &token, isc_tokentype_qstring, ISC_FALSE));
	RETERR(txt_fromtext(&token.value.as_textregion, target));

David Lawrence's avatar
David Lawrence committed
60 61 62
	/*
	 * Service.
	 */
Mark Andrews's avatar
Mark Andrews committed
63 64 65
	RETERR(gettoken(lexer, &token, isc_tokentype_qstring, ISC_FALSE));
	RETERR(txt_fromtext(&token.value.as_textregion, target));

David Lawrence's avatar
David Lawrence committed
66 67 68
	/*
	 * Regexp.
	 */
Mark Andrews's avatar
Mark Andrews committed
69 70 71
	RETERR(gettoken(lexer, &token, isc_tokentype_qstring, ISC_FALSE));
	RETERR(txt_fromtext(&token.value.as_textregion, target));

David Lawrence's avatar
David Lawrence committed
72 73 74
	/*
	 * Replacement.
	 */
Mark Andrews's avatar
Mark Andrews committed
75 76
	RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE));
	dns_name_init(&name, NULL);
77
	buffer_fromregion(&buffer, &token.value.as_region);
Mark Andrews's avatar
Mark Andrews committed
78 79 80 81
	origin = (origin != NULL) ? origin : dns_rootname;
	return (dns_name_fromtext(&name, &buffer, origin, downcase, target));
}

82
static inline isc_result_t
David Lawrence's avatar
David Lawrence committed
83
totext_in_naptr(ARGS_TOTEXT) {
Mark Andrews's avatar
Mark Andrews committed
84 85 86 87 88 89 90 91
	isc_region_t region;
	dns_name_t name;
	dns_name_t prefix;
	isc_boolean_t sub;
	char buf[sizeof "64000"];
	unsigned short num;

	REQUIRE(rdata->type == 35);
92
	REQUIRE(rdata->rdclass == 1);
Mark Andrews's avatar
Mark Andrews committed
93 94 95 96 97

	dns_name_init(&name, NULL);
	dns_name_init(&prefix, NULL);

	dns_rdata_toregion(rdata, &region);
98

David Lawrence's avatar
David Lawrence committed
99 100 101
	/*
	 * Order.
	 */
Mark Andrews's avatar
Mark Andrews committed
102 103 104 105 106 107
	num = uint16_fromregion(&region);
	isc_region_consume(&region, 2);
	sprintf(buf, "%u", num);
	RETERR(str_totext(buf, target));
	RETERR(str_totext(" ", target));

David Lawrence's avatar
David Lawrence committed
108 109 110
	/*
	 * Preference.
	 */
Mark Andrews's avatar
Mark Andrews committed
111 112 113 114 115 116
	num = uint16_fromregion(&region);
	isc_region_consume(&region, 2);
	sprintf(buf, "%u", num);
	RETERR(str_totext(buf, target));
	RETERR(str_totext(" ", target));

David Lawrence's avatar
David Lawrence committed
117 118 119
	/*
	 * Flags.
	 */
Mark Andrews's avatar
Mark Andrews committed
120 121 122
	RETERR(txt_totext(&region, target));
	RETERR(str_totext(" ", target));

David Lawrence's avatar
David Lawrence committed
123 124 125
	/*
	 * Service.
	 */
Mark Andrews's avatar
Mark Andrews committed
126 127 128
	RETERR(txt_totext(&region, target));
	RETERR(str_totext(" ", target));

David Lawrence's avatar
David Lawrence committed
129 130 131
	/*
	 * Regexp.
	 */
Mark Andrews's avatar
Mark Andrews committed
132 133 134
	RETERR(txt_totext(&region, target));
	RETERR(str_totext(" ", target));

David Lawrence's avatar
David Lawrence committed
135 136 137
	/*
	 * Replacement.
	 */
Mark Andrews's avatar
Mark Andrews committed
138
	dns_name_fromregion(&name, &region);
139
	sub = name_prefix(&name, tctx->origin, &prefix);
140
	return (dns_name_totext(&prefix, sub, target));
Mark Andrews's avatar
Mark Andrews committed
141 142
}

143
static inline isc_result_t
David Lawrence's avatar
David Lawrence committed
144
fromwire_in_naptr(ARGS_FROMWIRE) {
Mark Andrews's avatar
Mark Andrews committed
145 146 147 148
        dns_name_t name;
	isc_region_t sr;

	REQUIRE(type == 35);
149
	REQUIRE(rdclass == 1);
Mark Andrews's avatar
Mark Andrews committed
150

151
	dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
Mark Andrews's avatar
Mark Andrews committed
152 153 154
        
        dns_name_init(&name, NULL);

David Lawrence's avatar
David Lawrence committed
155 156 157
	/*
	 * Order, preference.
	 */
158
	isc_buffer_activeregion(source, &sr);
Mark Andrews's avatar
Mark Andrews committed
159
	if (sr.length < 4)
160
		return (ISC_R_UNEXPECTEDEND);
Mark Andrews's avatar
Mark Andrews committed
161 162 163
	RETERR(mem_tobuffer(target, sr.base, 4));
	isc_buffer_forward(source, 4);

David Lawrence's avatar
David Lawrence committed
164 165 166
	/*
	 * Flags.
	 */
Mark Andrews's avatar
Mark Andrews committed
167 168
	RETERR(txt_fromwire(source, target));

David Lawrence's avatar
David Lawrence committed
169 170 171
	/*
	 * Service.
	 */
Mark Andrews's avatar
Mark Andrews committed
172 173
	RETERR(txt_fromwire(source, target));

David Lawrence's avatar
David Lawrence committed
174 175 176
	/*
	 * Regexp.
	 */
Mark Andrews's avatar
Mark Andrews committed
177 178
	RETERR(txt_fromwire(source, target));

David Lawrence's avatar
David Lawrence committed
179 180 181
	/*
	 * Replacement.
	 */
Mark Andrews's avatar
Mark Andrews committed
182 183 184
	return (dns_name_fromwire(&name, source, dctx, downcase, target));
}

185
static inline isc_result_t
David Lawrence's avatar
David Lawrence committed
186
towire_in_naptr(ARGS_TOWIRE) {
Mark Andrews's avatar
Mark Andrews committed
187 188 189 190
	dns_name_t name;
	isc_region_t sr;

	REQUIRE(rdata->type == 35);
191
	REQUIRE(rdata->rdclass == 1);
Mark Andrews's avatar
Mark Andrews committed
192

193
	dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
David Lawrence's avatar
David Lawrence committed
194 195 196
	/*
	 * Order, preference.
	 */
Mark Andrews's avatar
Mark Andrews committed
197 198 199 200
	dns_rdata_toregion(rdata, &sr);
	RETERR(mem_tobuffer(target, sr.base, 4));
	isc_region_consume(&sr, 4);
	
David Lawrence's avatar
David Lawrence committed
201 202 203
	/*
	 * Flags.
	 */
Mark Andrews's avatar
Mark Andrews committed
204 205 206
	RETERR(mem_tobuffer(target, sr.base, sr.base[0] + 1));
	isc_region_consume(&sr, sr.base[0] + 1);

David Lawrence's avatar
David Lawrence committed
207 208 209
	/*
	 * Service.
	 */
Mark Andrews's avatar
Mark Andrews committed
210 211 212
	RETERR(mem_tobuffer(target, sr.base, sr.base[0] + 1));
	isc_region_consume(&sr, sr.base[0] + 1);

David Lawrence's avatar
David Lawrence committed
213 214 215
	/*
	 * Regexp.
	 */
Mark Andrews's avatar
Mark Andrews committed
216 217 218
	RETERR(mem_tobuffer(target, sr.base, sr.base[0] + 1));
	isc_region_consume(&sr, sr.base[0] + 1);

David Lawrence's avatar
David Lawrence committed
219 220 221
	/*
	 * Replacement.
	 */
Mark Andrews's avatar
Mark Andrews committed
222 223 224 225 226
	dns_name_init(&name, NULL);
	dns_name_fromregion(&name, &sr);
	return (dns_name_towire(&name, cctx, target));
}

227
static inline int
David Lawrence's avatar
David Lawrence committed
228
compare_in_naptr(ARGS_COMPARE) {
Mark Andrews's avatar
Mark Andrews committed
229 230 231 232
	dns_name_t name1;
	dns_name_t name2;
	isc_region_t region1;
	isc_region_t region2;
233
	int order, len;
Mark Andrews's avatar
Mark Andrews committed
234 235

	REQUIRE(rdata1->type == rdata2->type);
236
	REQUIRE(rdata1->rdclass == rdata2->rdclass);
Mark Andrews's avatar
Mark Andrews committed
237
	REQUIRE(rdata1->type == 35);
238
	REQUIRE(rdata1->rdclass == 1);
Mark Andrews's avatar
Mark Andrews committed
239 240 241 242

	dns_rdata_toregion(rdata1, &region1);
	dns_rdata_toregion(rdata2, &region2);

David Lawrence's avatar
David Lawrence committed
243 244 245
	/*
	 * Order, preference.
	 */
246 247 248
	order = memcmp(region1.base, region2.base, 4);
	if (order != 0)
		return (order < 0 ? -1 : 1);
Mark Andrews's avatar
Mark Andrews committed
249 250 251
	isc_region_consume(&region1, 4);
	isc_region_consume(&region2, 4);

David Lawrence's avatar
David Lawrence committed
252 253 254
	/*
	 * Flags.
	 */
255
	len = ISC_MIN(region1.base[0], region2.base[0]);
256 257 258
	order = memcmp(region1.base, region2.base, len + 1);
	if (order != 0)
		return (order < 0 ? -1 : 1);
Mark Andrews's avatar
Mark Andrews committed
259 260 261
	isc_region_consume(&region1, region1.base[0] + 1);
	isc_region_consume(&region2, region2.base[0] + 1);

David Lawrence's avatar
David Lawrence committed
262 263 264
	/*
	 * Service.
	 */
265
	len = ISC_MIN(region1.base[0], region2.base[0]);
266 267 268
	order = memcmp(region1.base, region2.base, len + 1);
	if (order != 0)
		return (order < 0 ? -1 : 1);
Mark Andrews's avatar
Mark Andrews committed
269 270 271
	isc_region_consume(&region1, region1.base[0] + 1);
	isc_region_consume(&region2, region2.base[0] + 1);

David Lawrence's avatar
David Lawrence committed
272 273 274
	/*
	 * Regexp.
	 */
275
	len = ISC_MIN(region1.base[0], region2.base[0]);
276 277 278
	order = memcmp(region1.base, region2.base, len + 1);
	if (order != 0)
		return (order < 0 ? -1 : 1);
Mark Andrews's avatar
Mark Andrews committed
279 280 281
	isc_region_consume(&region1, region1.base[0] + 1);
	isc_region_consume(&region2, region2.base[0] + 1);

David Lawrence's avatar
David Lawrence committed
282 283 284
	/*
	 * Replacement.
	 */
Mark Andrews's avatar
Mark Andrews committed
285 286 287 288 289 290
	dns_name_init(&name1, NULL);
	dns_name_init(&name2, NULL);

	dns_name_fromregion(&name1, &region1);
	dns_name_fromregion(&name2, &region2);

291
	return (dns_name_rdatacompare(&name1, &name2));
Mark Andrews's avatar
Mark Andrews committed
292 293
}

294
static inline isc_result_t
David Lawrence's avatar
David Lawrence committed
295
fromstruct_in_naptr(ARGS_FROMSTRUCT) {
296 297
	dns_rdata_in_naptr_t *naptr = source;
	isc_region_t region;
Mark Andrews's avatar
Mark Andrews committed
298 299

	REQUIRE(type == 35);
300
	REQUIRE(rdclass == 1);
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
	REQUIRE(source != NULL);
	REQUIRE(naptr->common.rdtype == type);
	REQUIRE(naptr->common.rdclass == rdclass);
	REQUIRE((naptr->flags == NULL && naptr->flags_len == 0) ||
		(naptr->flags != NULL && naptr->flags_len != 0));
	REQUIRE((naptr->service == NULL && naptr->service_len == 0) ||
		(naptr->service != NULL && naptr->service_len != 0));
	REQUIRE((naptr->regexp == NULL && naptr->regexp_len == 0) ||
		(naptr->regexp != NULL && naptr->regexp_len != 0));

	RETERR(uint16_tobuffer(naptr->order, target));
	RETERR(uint16_tobuffer(naptr->preference, target));
	RETERR(uint8_tobuffer(naptr->flags_len, target));
	RETERR(mem_tobuffer(target, naptr->flags, naptr->flags_len));
	RETERR(uint8_tobuffer(naptr->service_len, target));
	RETERR(mem_tobuffer(target, naptr->service, naptr->service_len));
	RETERR(uint8_tobuffer(naptr->regexp_len, target));
	RETERR(mem_tobuffer(target, naptr->regexp, naptr->regexp_len));
	dns_name_toregion(&naptr->replacement, &region);
	return (isc_buffer_copyregion(target, &region));
Mark Andrews's avatar
Mark Andrews committed
321 322
}

323
static inline isc_result_t
David Lawrence's avatar
David Lawrence committed
324
tostruct_in_naptr(ARGS_TOSTRUCT) {
325 326 327 328 329
	dns_rdata_in_naptr_t *naptr = target;
	isc_region_t r;
	isc_result_t result;
	dns_name_t name;

Mark Andrews's avatar
Mark Andrews committed
330
	REQUIRE(rdata->type == 35);
331
	REQUIRE(rdata->rdclass == 1);
332
	REQUIRE(target != NULL);
Mark Andrews's avatar
Mark Andrews committed
333

334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
	naptr->common.rdclass = rdata->rdclass;
	naptr->common.rdtype = rdata->type;
	ISC_LINK_INIT(&naptr->common, link);

	naptr->flags = NULL;
	naptr->service = NULL;
	naptr->regexp = NULL;

	dns_rdata_toregion(rdata, &r);

	naptr->order = uint16_fromregion(&r);
	isc_region_consume(&r, 2);

	naptr->preference = uint16_fromregion(&r);
	isc_region_consume(&r, 2);

	naptr->flags_len = uint8_fromregion(&r);
	isc_region_consume(&r, 1);
	if (naptr->flags_len != 0) {
353
		INSIST(naptr->flags_len <= r.length);
354 355 356 357 358
		naptr->flags = mem_maybedup(mctx, r.base, naptr->flags_len);
		if (naptr->flags == NULL)
			goto cleanup;
		isc_region_consume(&r, naptr->flags_len);
	}
359

360 361 362
	naptr->service_len = uint8_fromregion(&r);
	isc_region_consume(&r, 1);
	if (naptr->service_len != 0) {
363
		INSIST(naptr->service_len <= r.length);
364 365 366 367 368 369 370 371 372 373
		naptr->service = mem_maybedup(mctx, r.base,
					       naptr->service_len);
		if (naptr->service == NULL)
			goto cleanup;
		isc_region_consume(&r, naptr->service_len);
	}

	naptr->regexp_len = uint8_fromregion(&r);
	isc_region_consume(&r, 1);
	if (naptr->regexp_len != 0) {
374
		INSIST(naptr->regexp_len <= r.length);
375 376 377 378 379 380
		naptr->regexp = mem_maybedup(mctx, r.base, naptr->regexp_len);
		if (naptr->regexp == NULL)
			goto cleanup;
		isc_region_consume(&r, naptr->regexp_len);
	}

381 382 383
	dns_name_init(&name, NULL);
	dns_name_fromregion(&name, &r);
	dns_name_init(&naptr->replacement, NULL);
384 385 386 387
	result = name_duporclone(&name, mctx, &naptr->replacement);
	if (result != ISC_R_SUCCESS)
		goto cleanup;
	naptr->mctx = mctx;
388
	return (ISC_R_SUCCESS);
389 390 391 392 393 394 395 396 397

 cleanup:
	if (mctx != NULL && naptr->flags != NULL)
		isc_mem_free(mctx, naptr->flags);
	if (mctx != NULL && naptr->service != NULL)
		isc_mem_free(mctx, naptr->service);
	if (mctx != NULL && naptr->regexp != NULL)
		isc_mem_free(mctx, naptr->regexp);
	return (ISC_R_NOMEMORY);
Mark Andrews's avatar
Mark Andrews committed
398
}
399

400
static inline void
David Lawrence's avatar
David Lawrence committed
401
freestruct_in_naptr(ARGS_FREESTRUCT) {
402 403
	dns_rdata_in_naptr_t *naptr = source;
	
404
	REQUIRE(source != NULL);
405 406 407 408 409 410 411 412 413 414 415 416 417 418
	REQUIRE(naptr->common.rdclass == 1);
	REQUIRE(naptr->common.rdtype == 35);

	if (naptr->mctx == NULL)
		return;

	if (naptr->flags != NULL)
		isc_mem_free(naptr->mctx, naptr->flags);
	if (naptr->service != NULL)
		isc_mem_free(naptr->mctx, naptr->service);
	if (naptr->regexp != NULL)
		isc_mem_free(naptr->mctx, naptr->regexp);
	dns_name_free(&naptr->replacement, naptr->mctx);
	naptr->mctx = NULL;
419
}
420

421
static inline isc_result_t
David Lawrence's avatar
David Lawrence committed
422
additionaldata_in_naptr(ARGS_ADDLDATA) {
Bob Halley's avatar
Bob Halley committed
423 424 425 426 427 428
	dns_name_t name;
	isc_region_t sr;
	dns_rdatatype_t atype;
	unsigned int i, flagslen;
	char *cp;

429 430 431
	REQUIRE(rdata->type == 35);
	REQUIRE(rdata->rdclass == 1);

David Lawrence's avatar
David Lawrence committed
432 433 434
	/*
	 * Order, preference.
	 */
Bob Halley's avatar
Bob Halley committed
435 436 437
	dns_rdata_toregion(rdata, &sr);
	isc_region_consume(&sr, 4);
	
David Lawrence's avatar
David Lawrence committed
438 439 440
	/*
	 * Flags.
	 */
Bob Halley's avatar
Bob Halley committed
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
	atype = 0;
	flagslen = sr.base[0];
	cp = (char *)&sr.base[1];
	for (i = 0; i < flagslen; i++, cp++) {
		if (*cp == 'S' || *cp == 's') {
			atype = dns_rdatatype_srv;
			break;
		}
		if (*cp == 'A' || *cp == 'a') {
			atype = dns_rdatatype_a;
			break;
		}
	}
	isc_region_consume(&sr, flagslen + 1);

David Lawrence's avatar
David Lawrence committed
456 457 458
	/*
	 * Service.
	 */
Bob Halley's avatar
Bob Halley committed
459 460
	isc_region_consume(&sr, sr.base[0] + 1);

David Lawrence's avatar
David Lawrence committed
461 462 463
	/*
	 * Regexp.
	 */
Bob Halley's avatar
Bob Halley committed
464 465
	isc_region_consume(&sr, sr.base[0] + 1);

David Lawrence's avatar
David Lawrence committed
466 467 468
	/*
	 * Replacement.
	 */
Bob Halley's avatar
Bob Halley committed
469 470 471 472 473
	dns_name_init(&name, NULL);
	dns_name_fromregion(&name, &sr);

	if (atype != 0)
		return ((add)(arg, &name, atype));
474

475
	return (ISC_R_SUCCESS);
476 477
}

478
static inline isc_result_t
David Lawrence's avatar
David Lawrence committed
479
digest_in_naptr(ARGS_DIGEST) {
480 481
	isc_region_t r1, r2;
	unsigned int length, n;
482
	isc_result_t result;
483 484 485 486 487 488 489 490 491
	dns_name_t name;

	REQUIRE(rdata->type == 35);
	REQUIRE(rdata->rdclass == 1);

	dns_rdata_toregion(rdata, &r1);
	r2 = r1;
	length = 0;

David Lawrence's avatar
David Lawrence committed
492 493 494
	/*
	 * Order, preference.
	 */
495 496 497
	length += 4;
	isc_region_consume(&r2, 4);

David Lawrence's avatar
David Lawrence committed
498 499 500
	/*
	 * Flags.
	 */
501 502 503 504
	n = r2.base[0] + 1;
	length += n;
	isc_region_consume(&r2, n);

David Lawrence's avatar
David Lawrence committed
505 506 507
	/*
	 * Service.
	 */
508 509 510 511
	n = r2.base[0] + 1;
	length += n;
	isc_region_consume(&r2, n);

David Lawrence's avatar
David Lawrence committed
512 513 514
	/*
	 * Regexp.
	 */
515 516 517 518 519 520 521 522 523
	n = r2.base[0] + 1;
	length += n;
	isc_region_consume(&r2, n);

	/*
	 * Digest the RR up to the replacement name.
	 */
	r1.length = length;
	result = (digest)(arg, &r1);
524
	if (result != ISC_R_SUCCESS)
525 526
		return (result);

David Lawrence's avatar
David Lawrence committed
527 528 529
	/*
	 * Replacement.
	 */
530 531 532 533 534 535 536

	dns_name_init(&name, NULL);
	dns_name_fromregion(&name, &r2);
	
	return (dns_name_digest(&name, digest, arg));
}

537
#endif	/* RDATA_IN_1_NAPTR_35_C */