Use as_textregion.base not as_pointer. [RT #2385]
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user