mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 05:57:52 +00:00
Use as_textregion.base not as_pointer. [RT #2385]
This commit is contained in:
parent
e1c2a8b9c1
commit
c46f10e4a1
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: master.c,v 1.133 2001/12/11 20:52:38 marka Exp $ */
|
||||
/* $Id: master.c,v 1.134 2002/01/21 01:07:14 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -138,6 +138,8 @@ struct dns_incctx {
|
||||
#define DNS_LCTX_MAGIC ISC_MAGIC('L','c','t','x')
|
||||
#define DNS_LCTX_VALID(lctx) ISC_MAGIC_VALID(lctx, DNS_LCTX_MAGIC)
|
||||
|
||||
#define DNS_AS_STR(t) ((t).value.as_textregion.base)
|
||||
|
||||
static isc_result_t
|
||||
pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx);
|
||||
|
||||
@ -891,11 +893,10 @@ load(dns_loadctx_t *lctx) {
|
||||
* across the normal domain name processing.
|
||||
*/
|
||||
|
||||
if (strcasecmp(token.value.as_pointer,
|
||||
"$ORIGIN") == 0) {
|
||||
if (strcasecmp(DNS_AS_STR(token), "$ORIGIN") == 0) {
|
||||
GETTOKEN(lctx->lex, 0, &token, ISC_FALSE);
|
||||
finish_origin = ISC_TRUE;
|
||||
} else if (strcasecmp(token.value.as_pointer,
|
||||
} else if (strcasecmp(DNS_AS_STR(token),
|
||||
"$TTL") == 0) {
|
||||
GETTOKEN(lctx->lex, 0, &token, ISC_FALSE);
|
||||
result =
|
||||
@ -911,7 +912,7 @@ load(dns_loadctx_t *lctx) {
|
||||
lctx->default_ttl_known = ISC_TRUE;
|
||||
EXPECTEOL;
|
||||
continue;
|
||||
} else if (strcasecmp(token.value.as_pointer,
|
||||
} else if (strcasecmp(DNS_AS_STR(token),
|
||||
"$INCLUDE") == 0) {
|
||||
COMMITALL;
|
||||
if ((lctx->options & DNS_MASTER_NOINCLUDE)
|
||||
@ -938,7 +939,7 @@ load(dns_loadctx_t *lctx) {
|
||||
if (include_file != NULL)
|
||||
isc_mem_free(mctx, include_file);
|
||||
include_file = isc_mem_strdup(mctx,
|
||||
token.value.as_pointer);
|
||||
DNS_AS_STR(token));
|
||||
if (include_file == NULL) {
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto log_and_cleanup;
|
||||
@ -975,14 +976,14 @@ load(dns_loadctx_t *lctx) {
|
||||
* the actual inclusion later.
|
||||
*/
|
||||
finish_include = ISC_TRUE;
|
||||
} else if (strcasecmp(token.value.as_pointer,
|
||||
} else if (strcasecmp(DNS_AS_STR(token),
|
||||
"$DATE") == 0) {
|
||||
isc_int64_t dump_time64;
|
||||
isc_stdtime_t dump_time, current_time;
|
||||
GETTOKEN(lctx->lex, 0, &token, ISC_FALSE);
|
||||
isc_stdtime_get(¤t_time);
|
||||
result = dns_time64_fromtext(token.value.
|
||||
as_pointer, &dump_time64);
|
||||
result = dns_time64_fromtext(DNS_AS_STR(token),
|
||||
&dump_time64);
|
||||
if (MANYERRS(lctx, result)) {
|
||||
SETRESULT(lctx, result);
|
||||
LOGIT(result);
|
||||
@ -1007,7 +1008,7 @@ load(dns_loadctx_t *lctx) {
|
||||
ttl_offset = current_time - dump_time;
|
||||
EXPECTEOL;
|
||||
continue;
|
||||
} else if (strcasecmp(token.value.as_pointer,
|
||||
} else if (strcasecmp(DNS_AS_STR(token),
|
||||
"$GENERATE") == 0) {
|
||||
/*
|
||||
* Use default ttl if known otherwise
|
||||
@ -1041,15 +1042,14 @@ load(dns_loadctx_t *lctx) {
|
||||
/* range */
|
||||
GETTOKEN(lctx->lex, 0, &token, ISC_FALSE);
|
||||
range = isc_mem_strdup(mctx,
|
||||
token.value.as_pointer);
|
||||
DNS_AS_STR(token));
|
||||
if (range == NULL) {
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto log_and_cleanup;
|
||||
}
|
||||
/* LHS */
|
||||
GETTOKEN(lctx->lex, 0, &token, ISC_FALSE);
|
||||
lhs = isc_mem_strdup(mctx,
|
||||
token.value.as_pointer);
|
||||
lhs = isc_mem_strdup(mctx, DNS_AS_STR(token));
|
||||
if (lhs == NULL) {
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto log_and_cleanup;
|
||||
@ -1057,15 +1057,14 @@ load(dns_loadctx_t *lctx) {
|
||||
/* TYPE */
|
||||
GETTOKEN(lctx->lex, 0, &token, ISC_FALSE);
|
||||
gtype = isc_mem_strdup(mctx,
|
||||
token.value.as_pointer);
|
||||
DNS_AS_STR(token));
|
||||
if (gtype == NULL) {
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto log_and_cleanup;
|
||||
}
|
||||
/* RHS */
|
||||
GETTOKEN(lctx->lex, 0, &token, ISC_FALSE);
|
||||
rhs = isc_mem_strdup(mctx,
|
||||
token.value.as_pointer);
|
||||
rhs = isc_mem_strdup(mctx, DNS_AS_STR(token));
|
||||
if (rhs == NULL) {
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto log_and_cleanup;
|
||||
@ -1078,13 +1077,13 @@ load(dns_loadctx_t *lctx) {
|
||||
goto insist_and_cleanup;
|
||||
EXPECTEOL;
|
||||
continue;
|
||||
} else if (strncasecmp(token.value.as_pointer,
|
||||
} else if (strncasecmp(DNS_AS_STR(token),
|
||||
"$", 1) == 0) {
|
||||
(callbacks->error)(callbacks,
|
||||
"%s: %s:%lu: "
|
||||
"unknown $ directive '%s'",
|
||||
"dns_master_load", source, line,
|
||||
token.value.as_pointer);
|
||||
DNS_AS_STR(token));
|
||||
result = DNS_R_SYNTAX;
|
||||
if (MANYERRS(lctx, result)) {
|
||||
SETRESULT(lctx, result);
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: rdata.c,v 1.157 2002/01/05 07:05:05 ogud Exp $ */
|
||||
/* $Id: rdata.c,v 1.158 2002/01/21 01:07:16 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
#include <ctype.h>
|
||||
@ -51,6 +51,7 @@
|
||||
if (_r != ISC_R_SUCCESS) \
|
||||
return (_r); \
|
||||
} while (0)
|
||||
|
||||
#define RETTOK(x) \
|
||||
do { \
|
||||
isc_result_t _r = (x); \
|
||||
@ -60,6 +61,8 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DNS_AS_STR(t) ((t).value.as_textregion.base)
|
||||
|
||||
#define ARGS_FROMTEXT int rdclass, dns_rdatatype_t type, \
|
||||
isc_lex_t *lexer, dns_name_t *origin, \
|
||||
isc_boolean_t downcase, isc_buffer_t *target, \
|
||||
@ -696,7 +699,7 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
|
||||
return (result);
|
||||
}
|
||||
|
||||
if (strcmp((char *)token.value.as_pointer, "\\#") == 0)
|
||||
if (strcmp(DNS_AS_STR(token), "\\#") == 0)
|
||||
result = unknown_fromtext(rdclass, type, lexer, mctx, target);
|
||||
else {
|
||||
isc_lex_ungettoken(lexer, &token);
|
||||
@ -1802,7 +1805,7 @@ atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
oeor = strtol(token.value.as_pointer, &e, 16);
|
||||
oeor = strtol(DNS_AS_STR(token), &e, 16);
|
||||
if (*e != 0)
|
||||
return (DNS_R_SYNTAX);
|
||||
|
||||
@ -1811,7 +1814,7 @@ atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
osum = strtol(token.value.as_pointer, &e, 16);
|
||||
osum = strtol(DNS_AS_STR(token), &e, 16);
|
||||
if (*e != 0)
|
||||
return (DNS_R_SYNTAX);
|
||||
|
||||
@ -1820,7 +1823,7 @@ atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
orot = strtol(token.value.as_pointer, &e, 16);
|
||||
orot = strtol(DNS_AS_STR(token), &e, 16);
|
||||
if (*e != 0)
|
||||
return (DNS_R_SYNTAX);
|
||||
|
||||
@ -1973,7 +1976,7 @@ fromtext_error(void (*callback)(dns_rdatacallbacks_t *, const char *, ...),
|
||||
case isc_tokentype_qstring:
|
||||
(*callback)(callbacks, "%s: %s:%lu: near '%s': %s",
|
||||
"dns_rdata_fromtext", name, line,
|
||||
(char *)token->value.as_pointer,
|
||||
DNS_AS_STR(*token),
|
||||
dns_result_totext(result));
|
||||
break;
|
||||
default:
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: tsig_250.c,v 1.54 2002/01/05 07:05:06 ogud Exp $ */
|
||||
/* $Id: tsig_250.c,v 1.55 2002/01/21 01:07:18 marka Exp $ */
|
||||
|
||||
/* Reviewed: Thu Mar 16 13:39:43 PST 2000 by gson */
|
||||
|
||||
@ -57,7 +57,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
sigtime = isc_string_touint64(token.value.as_pointer, &e, 10);
|
||||
sigtime = isc_string_touint64(DNS_AS_STR(token), &e, 10);
|
||||
if (*e != 0)
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
if ((sigtime >> 48) != 0)
|
||||
@ -105,7 +105,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) {
|
||||
if (dns_tsigrcode_fromtext(&rcode, &token.value.as_textregion)
|
||||
!= ISC_R_SUCCESS)
|
||||
{
|
||||
i = strtol(token.value.as_pointer, &e, 10);
|
||||
i = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e != 0)
|
||||
RETTOK(DNS_R_UNKNOWN);
|
||||
if (i < 0 || i > 0xffff)
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: loc_29.c,v 1.32 2002/01/05 07:05:13 ogud Exp $ */
|
||||
/* $Id: loc_29.c,v 1.33 2002/01/21 01:07:19 marka Exp $ */
|
||||
|
||||
/* Reviewed: Wed Mar 15 18:13:09 PST 2000 by explorer */
|
||||
|
||||
@ -81,11 +81,11 @@ fromtext_loc(ARGS_FROMTEXT) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
if (strcasecmp(token.value.as_pointer, "N") == 0)
|
||||
if (strcasecmp(DNS_AS_STR(token), "N") == 0)
|
||||
north = ISC_TRUE;
|
||||
if (north || strcasecmp(token.value.as_pointer, "S") == 0)
|
||||
if (north || strcasecmp(DNS_AS_STR(token), "S") == 0)
|
||||
goto getlong;
|
||||
m1 = strtol(token.value.as_pointer, &e, 10);
|
||||
m1 = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e != 0)
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
if (m1 < 0 || m1 > 59)
|
||||
@ -98,11 +98,11 @@ fromtext_loc(ARGS_FROMTEXT) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
if (strcasecmp(token.value.as_pointer, "N") == 0)
|
||||
if (strcasecmp(DNS_AS_STR(token), "N") == 0)
|
||||
north = ISC_TRUE;
|
||||
if (north || strcasecmp(token.value.as_pointer, "S") == 0)
|
||||
if (north || strcasecmp(DNS_AS_STR(token), "S") == 0)
|
||||
goto getlong;
|
||||
s1 = strtol(token.value.as_pointer, &e, 10);
|
||||
s1 = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e != 0 && *e != '.')
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
if (s1 < 0 || s1 > 59)
|
||||
@ -131,9 +131,9 @@ fromtext_loc(ARGS_FROMTEXT) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
if (strcasecmp(token.value.as_pointer, "N") == 0)
|
||||
if (strcasecmp(DNS_AS_STR(token), "N") == 0)
|
||||
north = ISC_TRUE;
|
||||
if (!north && strcasecmp(token.value.as_pointer, "S") != 0)
|
||||
if (!north && strcasecmp(DNS_AS_STR(token), "S") != 0)
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
|
||||
getlong:
|
||||
@ -151,11 +151,11 @@ fromtext_loc(ARGS_FROMTEXT) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
if (strcasecmp(token.value.as_pointer, "E") == 0)
|
||||
if (strcasecmp(DNS_AS_STR(token), "E") == 0)
|
||||
east = ISC_TRUE;
|
||||
if (east || strcasecmp(token.value.as_pointer, "W") == 0)
|
||||
if (east || strcasecmp(DNS_AS_STR(token), "W") == 0)
|
||||
goto getalt;
|
||||
m2 = strtol(token.value.as_pointer, &e, 10);
|
||||
m2 = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e != 0)
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
if (m2 < 0 || m2 > 59)
|
||||
@ -168,11 +168,11 @@ fromtext_loc(ARGS_FROMTEXT) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
if (strcasecmp(token.value.as_pointer, "E") == 0)
|
||||
if (strcasecmp(DNS_AS_STR(token), "E") == 0)
|
||||
east = ISC_TRUE;
|
||||
if (east || strcasecmp(token.value.as_pointer, "W") == 0)
|
||||
if (east || strcasecmp(DNS_AS_STR(token), "W") == 0)
|
||||
goto getalt;
|
||||
s2 = strtol(token.value.as_pointer, &e, 10);
|
||||
s2 = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e != 0 && *e != '.')
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
if (s2 < 0 || s2 > 59)
|
||||
@ -201,9 +201,9 @@ fromtext_loc(ARGS_FROMTEXT) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
if (strcasecmp(token.value.as_pointer, "E") == 0)
|
||||
if (strcasecmp(DNS_AS_STR(token), "E") == 0)
|
||||
east = ISC_TRUE;
|
||||
if (!east && strcasecmp(token.value.as_pointer, "W") != 0)
|
||||
if (!east && strcasecmp(DNS_AS_STR(token), "W") != 0)
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
|
||||
getalt:
|
||||
@ -212,7 +212,7 @@ fromtext_loc(ARGS_FROMTEXT) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
m = strtol(token.value.as_pointer, &e, 10);
|
||||
m = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e != 0 && *e != '.' && *e != 'm')
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
if (m < -100000 || m > 42849672)
|
||||
@ -259,7 +259,7 @@ fromtext_loc(ARGS_FROMTEXT) {
|
||||
isc_lex_ungettoken(lexer, &token);
|
||||
goto encode;
|
||||
}
|
||||
m = strtol(token.value.as_pointer, &e, 10);
|
||||
m = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e != 0 && *e != '.' && *e != 'm')
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
if (m < 0 || m > 90000000)
|
||||
@ -312,7 +312,7 @@ fromtext_loc(ARGS_FROMTEXT) {
|
||||
isc_lex_ungettoken(lexer, &token);
|
||||
goto encode;
|
||||
}
|
||||
m = strtol(token.value.as_pointer, &e, 10);
|
||||
m = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e != 0 && *e != '.' && *e != 'm')
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
if (m < 0 || m > 90000000)
|
||||
@ -363,7 +363,7 @@ fromtext_loc(ARGS_FROMTEXT) {
|
||||
isc_lex_ungettoken(lexer, &token);
|
||||
goto encode;
|
||||
}
|
||||
m = strtol(token.value.as_pointer, &e, 10);
|
||||
m = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e != 0 && *e != '.' && *e != 'm')
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
if (m < 0 || m > 90000000)
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: nxt_30.c,v 1.52 2002/01/05 07:05:15 ogud Exp $ */
|
||||
/* $Id: nxt_30.c,v 1.53 2002/01/21 01:07:21 marka Exp $ */
|
||||
|
||||
/* reviewed: Wed Mar 15 18:21:15 PST 2000 by brister */
|
||||
|
||||
@ -64,8 +64,8 @@ fromtext_nxt(ARGS_FROMTEXT) {
|
||||
isc_tokentype_string, ISC_TRUE));
|
||||
if (token.type != isc_tokentype_string)
|
||||
break;
|
||||
n = strtol(token.value.as_pointer, &e, 10);
|
||||
if (e != (char *)token.value.as_pointer && *e == '\0') {
|
||||
n = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (e != DNS_AS_STR(token) && *e == '\0') {
|
||||
covered = (dns_rdatatype_t)n;
|
||||
} else if (dns_rdatatype_fromtext(&covered,
|
||||
&token.value.as_textregion) == DNS_R_UNKNOWN)
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: sig_24.c,v 1.56 2002/01/05 07:05:18 ogud Exp $ */
|
||||
/* $Id: sig_24.c,v 1.57 2002/01/21 01:07:22 marka Exp $ */
|
||||
|
||||
/* Reviewed: Fri Mar 17 09:05:02 PST 2000 by gson */
|
||||
|
||||
@ -51,7 +51,7 @@ fromtext_sig(ARGS_FROMTEXT) {
|
||||
ISC_FALSE));
|
||||
result = dns_rdatatype_fromtext(&covered, &token.value.as_textregion);
|
||||
if (result != ISC_R_SUCCESS && result != ISC_R_NOTIMPLEMENTED) {
|
||||
i = strtol(token.value.as_pointer, &e, 10);
|
||||
i = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (i < 0 || i > 65535)
|
||||
RETTOK(ISC_R_RANGE);
|
||||
if (*e != 0)
|
||||
@ -90,7 +90,7 @@ fromtext_sig(ARGS_FROMTEXT) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
RETTOK(dns_time32_fromtext(token.value.as_pointer, &time_expire));
|
||||
RETTOK(dns_time32_fromtext(DNS_AS_STR(token), &time_expire));
|
||||
RETERR(uint32_tobuffer(time_expire, target));
|
||||
|
||||
/*
|
||||
@ -98,7 +98,7 @@ fromtext_sig(ARGS_FROMTEXT) {
|
||||
*/
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
RETTOK(dns_time32_fromtext(token.value.as_pointer, &time_signed));
|
||||
RETTOK(dns_time32_fromtext(DNS_AS_STR(token), &time_signed));
|
||||
RETERR(uint32_tobuffer(time_signed, target));
|
||||
|
||||
/*
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: tkey_249.c,v 1.50 2002/01/05 07:05:20 ogud Exp $ */
|
||||
/* $Id: tkey_249.c,v 1.51 2002/01/21 01:07:23 marka Exp $ */
|
||||
|
||||
/*
|
||||
* Reviewed: Thu Mar 16 17:35:30 PST 2000 by halley.
|
||||
@ -85,7 +85,7 @@ fromtext_tkey(ARGS_FROMTEXT) {
|
||||
if (dns_tsigrcode_fromtext(&rcode, &token.value.as_textregion)
|
||||
!= ISC_R_SUCCESS)
|
||||
{
|
||||
i = strtol(token.value.as_pointer, &e, 10);
|
||||
i = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e != 0)
|
||||
RETTOK(DNS_R_UNKNOWN);
|
||||
if (i < 0 || i > 0xffff)
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: a_1.c,v 1.25 2001/07/16 03:06:37 marka Exp $ */
|
||||
/* $Id: a_1.c,v 1.26 2002/01/21 01:07:24 marka Exp $ */
|
||||
|
||||
/* reviewed: Thu Mar 16 15:58:36 PST 2000 by brister */
|
||||
|
||||
@ -43,7 +43,7 @@ fromtext_hs_a(ARGS_FROMTEXT) {
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
|
||||
if (getquad(token.value.as_pointer, &addr, lexer, callbacks) != 1)
|
||||
if (getquad(DNS_AS_STR(token), &addr, lexer, callbacks) != 1)
|
||||
RETTOK(DNS_R_BADDOTTEDQUAD);
|
||||
isc_buffer_availableregion(target, ®ion);
|
||||
if (region.length < 4)
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: a6_38.c,v 1.47 2001/11/27 01:55:44 gson Exp $ */
|
||||
/* $Id: a6_38.c,v 1.48 2002/01/21 01:07:26 marka Exp $ */
|
||||
|
||||
/* RFC2874 */
|
||||
|
||||
@ -68,7 +68,7 @@ fromtext_in_a6(ARGS_FROMTEXT) {
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token,
|
||||
isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
if (inet_pton(AF_INET6, token.value.as_pointer, addr) != 1)
|
||||
if (inet_pton(AF_INET6, DNS_AS_STR(token), addr) != 1)
|
||||
RETTOK(DNS_R_BADAAAA);
|
||||
mask = 0xff >> (prefixlen % 8);
|
||||
addr[octets] &= mask;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: a_1.c,v 1.47 2002/01/05 07:05:25 ogud Exp $ */
|
||||
/* $Id: a_1.c,v 1.48 2002/01/21 01:07:28 marka Exp $ */
|
||||
|
||||
/* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */
|
||||
|
||||
@ -45,7 +45,7 @@ fromtext_in_a(ARGS_FROMTEXT) {
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
|
||||
if (getquad(token.value.as_pointer, &addr, lexer, callbacks) != 1)
|
||||
if (getquad(DNS_AS_STR(token), &addr, lexer, callbacks) != 1)
|
||||
RETTOK(DNS_R_BADDOTTEDQUAD);
|
||||
isc_buffer_availableregion(target, ®ion);
|
||||
if (region.length < 4)
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: aaaa_28.c,v 1.37 2002/01/05 07:05:26 ogud Exp $ */
|
||||
/* $Id: aaaa_28.c,v 1.38 2002/01/21 01:07:29 marka Exp $ */
|
||||
|
||||
/* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */
|
||||
|
||||
@ -46,7 +46,7 @@ fromtext_in_aaaa(ARGS_FROMTEXT) {
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
|
||||
if (inet_pton(AF_INET6, token.value.as_pointer, addr) != 1)
|
||||
if (inet_pton(AF_INET6, DNS_AS_STR(token), addr) != 1)
|
||||
RETTOK(DNS_R_BADAAAA);
|
||||
isc_buffer_availableregion(target, ®ion);
|
||||
if (region.length < 16)
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: wks_11.c,v 1.47 2002/01/05 07:05:28 ogud Exp $ */
|
||||
/* $Id: wks_11.c,v 1.48 2002/01/21 01:07:30 marka Exp $ */
|
||||
|
||||
/* Reviewed: Fri Mar 17 15:01:49 PST 2000 by explorer */
|
||||
|
||||
@ -62,7 +62,7 @@ fromtext_in_wks(ARGS_FROMTEXT) {
|
||||
ISC_FALSE));
|
||||
|
||||
isc_buffer_availableregion(target, ®ion);
|
||||
if (getquad(token.value.as_pointer, &addr, lexer, callbacks) != 1)
|
||||
if (getquad(DNS_AS_STR(token), &addr, lexer, callbacks) != 1)
|
||||
RETTOK(DNS_R_BADDOTTEDQUAD);
|
||||
if (region.length < 4)
|
||||
return (ISC_R_NOSPACE);
|
||||
@ -75,10 +75,10 @@ fromtext_in_wks(ARGS_FROMTEXT) {
|
||||
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
|
||||
ISC_FALSE));
|
||||
|
||||
proto = strtol(token.value.as_pointer, &e, 10);
|
||||
proto = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e == 0)
|
||||
;
|
||||
else if ((pe = getprotobyname(token.value.as_pointer)) != NULL)
|
||||
else if ((pe = getprotobyname(DNS_AS_STR(token))) != NULL)
|
||||
proto = pe->p_proto;
|
||||
else
|
||||
RETTOK(DNS_R_UNKNOWNPROTO);
|
||||
@ -103,18 +103,18 @@ fromtext_in_wks(ARGS_FROMTEXT) {
|
||||
* Lowercase the service string as some getservbyname() are
|
||||
* case sensitive and the database is usually in lowercase.
|
||||
*/
|
||||
strncpy(service, token.value.as_pointer, sizeof(service));
|
||||
strncpy(service, DNS_AS_STR(token), sizeof(service));
|
||||
service[sizeof(service)-1] = '\0';
|
||||
for (i = strlen(service) - 1; i >= 0; i--)
|
||||
if (isupper(service[i]&0xff))
|
||||
service[i] = tolower(service[i]);
|
||||
|
||||
port = strtol(token.value.as_pointer, &e, 10);
|
||||
port = strtol(DNS_AS_STR(token), &e, 10);
|
||||
if (*e == 0)
|
||||
;
|
||||
else if ((se = getservbyname(service, ps)) != NULL)
|
||||
port = ntohs(se->s_port);
|
||||
else if ((se = getservbyname(token.value.as_pointer, ps))
|
||||
else if ((se = getservbyname(DNS_AS_STR(token), ps))
|
||||
!= NULL)
|
||||
port = ntohs(se->s_port);
|
||||
else
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
/*
|
||||
* Principal Author: Brian Wellington
|
||||
* $Id: dst_api.c,v 1.100 2001/12/18 06:05:39 bwelling Exp $
|
||||
* $Id: dst_api.c,v 1.101 2002/01/21 01:07:31 marka Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -50,6 +50,8 @@
|
||||
|
||||
#include "dst_internal.h"
|
||||
|
||||
#define DST_AS_STR(t) ((t).value.as_textregion.base)
|
||||
|
||||
static dst_func_t *dst_t_func[DST_MAX_ALGS];
|
||||
static isc_entropy_t *dst_entropy_pool = NULL;
|
||||
static unsigned int dst_entropy_flags = 0;
|
||||
@ -803,7 +805,6 @@ read_public_key(const char *filename, isc_mem_t *mctx, dst_key_t **keyp) {
|
||||
unsigned int opt = ISC_LEXOPT_DNSMULTILINE;
|
||||
char *newfilename;
|
||||
unsigned int newfilenamelen;
|
||||
isc_textregion_t r;
|
||||
dns_rdataclass_t rdclass = dns_rdataclass_in;
|
||||
|
||||
newfilenamelen = strlen(filename) + 5;
|
||||
@ -845,9 +846,8 @@ read_public_key(const char *filename, isc_mem_t *mctx, dst_key_t **keyp) {
|
||||
if (token.type != isc_tokentype_string)
|
||||
BADTOKEN();
|
||||
dns_fixedname_init(&name);
|
||||
isc_buffer_init(&b, token.value.as_pointer,
|
||||
strlen(token.value.as_pointer));
|
||||
isc_buffer_add(&b, strlen(token.value.as_pointer));
|
||||
isc_buffer_init(&b, DST_AS_STR(token), strlen(DST_AS_STR(token)));
|
||||
isc_buffer_add(&b, strlen(DST_AS_STR(token)));
|
||||
ret = dns_name_fromtext(dns_fixedname_name(&name), &b, dns_rootname,
|
||||
ISC_FALSE, NULL);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
@ -863,16 +863,14 @@ read_public_key(const char *filename, isc_mem_t *mctx, dst_key_t **keyp) {
|
||||
if (token.type != isc_tokentype_string)
|
||||
BADTOKEN();
|
||||
|
||||
r.base = token.value.as_pointer;
|
||||
r.length = strlen(r.base);
|
||||
ret = dns_rdataclass_fromtext(&rdclass, &r);
|
||||
ret = dns_rdataclass_fromtext(&rdclass, &token.value.as_textregion);
|
||||
if (ret == ISC_R_SUCCESS)
|
||||
NEXTTOKEN(lex, opt, &token);
|
||||
|
||||
if (token.type != isc_tokentype_string)
|
||||
BADTOKEN();
|
||||
|
||||
if (strcasecmp(token.value.as_pointer, "KEY") != 0)
|
||||
if (strcasecmp(DST_AS_STR(token), "KEY") != 0)
|
||||
BADTOKEN();
|
||||
|
||||
isc_buffer_init(&b, rdatabuf, sizeof(rdatabuf));
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
/*
|
||||
* Principal Author: Brian Wellington
|
||||
* $Id: dst_parse.c,v 1.34 2001/11/30 01:59:30 gson Exp $
|
||||
* $Id: dst_parse.c,v 1.35 2002/01/21 01:07:32 marka Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -36,6 +36,7 @@
|
||||
#include "dst_parse.h"
|
||||
#include "dst/result.h"
|
||||
|
||||
#define DST_AS_STR(t) ((t).value.as_textregion.base)
|
||||
|
||||
#define PRIVATE_KEY_STR "Private-key-format:"
|
||||
#define ALGORITHM_STR "Algorithm:"
|
||||
@ -232,7 +233,7 @@ dst__privstruct_parsefile(dst_key_t *key, unsigned int alg,
|
||||
*/
|
||||
NEXTTOKEN(lex, opt, &token);
|
||||
if (token.type != isc_tokentype_string ||
|
||||
strcmp(token.value.as_pointer, PRIVATE_KEY_STR) != 0)
|
||||
strcmp(DST_AS_STR(token), PRIVATE_KEY_STR) != 0)
|
||||
{
|
||||
ret = DST_R_INVALIDPRIVATEKEY;
|
||||
goto fail;
|
||||
@ -240,12 +241,12 @@ dst__privstruct_parsefile(dst_key_t *key, unsigned int alg,
|
||||
|
||||
NEXTTOKEN(lex, opt, &token);
|
||||
if (token.type != isc_tokentype_string ||
|
||||
((char *)token.value.as_pointer)[0] != 'v')
|
||||
(DST_AS_STR(token))[0] != 'v')
|
||||
{
|
||||
ret = DST_R_INVALIDPRIVATEKEY;
|
||||
goto fail;
|
||||
}
|
||||
if (sscanf(token.value.as_pointer, "v%d.%d", &major, &minor) != 2)
|
||||
if (sscanf(DST_AS_STR(token), "v%d.%d", &major, &minor) != 2)
|
||||
{
|
||||
ret = DST_R_INVALIDPRIVATEKEY;
|
||||
goto fail;
|
||||
@ -265,7 +266,7 @@ dst__privstruct_parsefile(dst_key_t *key, unsigned int alg,
|
||||
*/
|
||||
NEXTTOKEN(lex, opt, &token);
|
||||
if (token.type != isc_tokentype_string ||
|
||||
strcmp(token.value.as_pointer, ALGORITHM_STR) != 0)
|
||||
strcmp(DST_AS_STR(token), ALGORITHM_STR) != 0)
|
||||
{
|
||||
ret = DST_R_INVALIDPRIVATEKEY;
|
||||
goto fail;
|
||||
@ -303,7 +304,7 @@ dst__privstruct_parsefile(dst_key_t *key, unsigned int alg,
|
||||
}
|
||||
|
||||
memset(&priv->elements[n], 0, sizeof(dst_private_element_t));
|
||||
tag = find_value(token.value.as_pointer, alg);
|
||||
tag = find_value(DST_AS_STR(token), alg);
|
||||
if (tag < 0 || TAG_ALG(tag) != alg) {
|
||||
ret = DST_R_INVALIDPRIVATEKEY;
|
||||
goto fail;
|
||||
|
Loading…
x
Reference in New Issue
Block a user