naptr_35.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 1999-2001, 2003-2005, 2007-2009, 2011-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id$ */
/* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */
/* RFC2915 */
#ifndef RDATA_GENERIC_NAPTR_35_C
#define RDATA_GENERIC_NAPTR_35_C
#define RRTYPE_NAPTR_ATTRIBUTES (0)
/*
* Check the wire format of the Regexp field.
* Don't allow embeded NUL's.
*/
static inline isc_result_t
txt_valid_regex(const unsigned char *txt) {
unsigned int nsub = 0;
char regex[256];
char *cp;
unsigned char c;
unsigned char delim;
unsigned int len;
int n;
if (len == 0U)
return (ISC_R_SUCCESS);
len--;
/*
* Digits, backslash and flags can't be delimiters.
*/
switch (delim) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case '\\': case 'i': case 0:
return (DNS_R_SYNTAX);
}
while (len-- > 0) {
c = *txt++;
if (c == 0)
return (DNS_R_SYNTAX);
continue;
continue;
} else if (c == delim)
return (DNS_R_SYNTAX);
/*
* Flags are not escaped.
*/
if (flags) {
switch (c) {
case 'i':
continue;
default:
return (DNS_R_SYNTAX);
}
}
if (!replace)
*cp++ = c;
if (c == '\\') {
if (len == 0)
return (DNS_R_SYNTAX);
c = *txt++;
if (c == 0)
return (DNS_R_SYNTAX);
len--;
if (replace)
switch (c) {
case '0': return (DNS_R_SYNTAX);
}
if (!replace)
*cp++ = c;
}
}
if (!flags)
return (DNS_R_SYNTAX);
*cp = '\0';
n = isc_regex_validate(regex);
if (n < 0 || nsub > (unsigned int)n)
return (DNS_R_SYNTAX);
return (ISC_R_SUCCESS);
}
static inline isc_result_t
unsigned char *regex;
/*
* Order.
*/
ISC_FALSE));
/*
* Preference.
*/
ISC_FALSE));
/*
* Flags.
*/
ISC_FALSE));
/*
* Service.
*/
ISC_FALSE));
/*
* Regexp.
*/
ISC_FALSE));
/*
* Replacement.
*/
ISC_FALSE));
return (ISC_R_SUCCESS);
}
static inline isc_result_t
char buf[sizeof("64000")];
unsigned short num;
/*
* Order.
*/
/*
* Preference.
*/
/*
* Flags.
*/
/*
* Service.
*/
/*
* Regexp.
*/
/*
* Replacement.
*/
}
static inline isc_result_t
unsigned char *regex;
/*
* Order, preference.
*/
return (ISC_R_UNEXPECTEDEND);
/*
* Flags.
*/
/*
* Service.
*/
/*
* Regexp.
*/
/*
* Replacement.
*/
}
static inline isc_result_t
/*
* Order, preference.
*/
/*
* Flags.
*/
/*
* Service.
*/
/*
* Regexp.
*/
/*
* Replacement.
*/
}
static inline int
/*
* Order, preference.
*/
if (order != 0)
/*
* Flags.
*/
if (order != 0)
/*
* Service.
*/
if (order != 0)
/*
* Regexp.
*/
if (order != 0)
/*
* Replacement.
*/
}
static inline isc_result_t
}
static inline isc_result_t
isc_region_t r;
dns_rdata_toregion(rdata, &r);
isc_region_consume(&r, 2);
isc_region_consume(&r, 2);
isc_region_consume(&r, 1);
goto cleanup;
isc_region_consume(&r, 1);
goto cleanup;
isc_region_consume(&r, 1);
goto cleanup;
dns_name_fromregion(&name, &r);
if (result != ISC_R_SUCCESS)
goto cleanup;
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
}
static inline void
return;
}
static inline isc_result_t
unsigned int i, flagslen;
char *cp;
/*
* Order, preference.
*/
/*
* Flags.
*/
atype = 0;
break;
}
break;
}
}
/*
* Service.
*/
/*
* Regexp.
*/
/*
* Replacement.
*/
if (atype != 0)
return (ISC_R_SUCCESS);
}
static inline isc_result_t
unsigned int length, n;
length = 0;
/*
* Order, preference.
*/
length += 4;
/*
* Flags.
*/
length += n;
isc_region_consume(&r2, n);
/*
* Service.
*/
length += n;
isc_region_consume(&r2, n);
/*
* Regexp.
*/
length += n;
isc_region_consume(&r2, n);
/*
* Digest the RR up to the replacement name.
*/
if (result != ISC_R_SUCCESS)
return (result);
/*
* Replacement.
*/
}
static inline isc_boolean_t
return (ISC_TRUE);
}
static inline isc_boolean_t
return (ISC_TRUE);
}
static inline int
}
#endif /* RDATA_GENERIC_NAPTR_35_C */