update unbound from upstream

This commit is contained in:
Riccardo Spagni 2014-12-04 23:10:49 +02:00
parent 9f74cc8e19
commit 831933425b
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
72 changed files with 1261 additions and 2655 deletions

View file

@ -235,6 +235,7 @@ setup_ctx(char* key, char* cert)
SSL_CTX* ctx = SSL_CTX_new(SSLv23_server_method());
if(!ctx) print_exit("out of memory");
(void)SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2);
(void)SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv3);
if(!SSL_CTX_use_certificate_file(ctx, cert, SSL_FILETYPE_PEM))
print_exit("cannot read cert");
if(!SSL_CTX_use_PrivateKey_file(ctx, key, SSL_FILETYPE_PEM))

View file

@ -49,7 +49,7 @@ static void
skip_whites(const char** p)
{
while(1) {
while(isspace((int)**p))
while(isspace((unsigned char)**p))
(*p)++;
if(**p == ';') {
/* comment, skip until newline */
@ -71,11 +71,11 @@ void hex_to_buf(sldns_buffer* pkt, const char* hex)
skip_whites(&p);
if(sldns_buffer_position(pkt) == sldns_buffer_limit(pkt))
fatal_exit("hex_to_buf: buffer too small");
if(!isalnum((int)*p))
if(!isalnum((unsigned char)*p))
break;
val = sldns_hexdigit_to_int(*p++) << 4;
skip_whites(&p);
log_assert(*p && isalnum((int)*p));
log_assert(*p && isalnum((unsigned char)*p));
val |= sldns_hexdigit_to_int(*p++);
sldns_buffer_write_u8(pkt, (uint8_t)val);
skip_whites(&p);

View file

@ -130,7 +130,7 @@ strip_end_white(char* p)
{
size_t i;
for(i = strlen(p); i > 0; i--) {
if(isspace((int)p[i-1]))
if(isspace((unsigned char)p[i-1]))
p[i-1] = 0;
else return;
}
@ -170,14 +170,14 @@ replay_range_read(char* remain, FILE* in, const char* name,
while(fgets(line, MAX_LINE_LEN-1, in)) {
pstate->lineno++;
parse = line;
while(isspace((int)*parse))
while(isspace((unsigned char)*parse))
parse++;
if(!*parse || *parse == ';') {
pos = ftello(in);
continue;
}
if(parse_keyword(&parse, "ADDRESS")) {
while(isspace((int)*parse))
while(isspace((unsigned char)*parse))
parse++;
strip_end_white(parse);
if(!extstrtoaddr(parse, &rng->addr, &rng->addrlen)) {
@ -281,7 +281,7 @@ replay_moment_read(char* remain, FILE* in, const char* name,
return NULL;
}
remain += skip;
while(isspace((int)*remain))
while(isspace((unsigned char)*remain))
remain++;
if(parse_keyword(&remain, "NOTHING")) {
mom->evt_type = repevt_nothing;
@ -303,10 +303,10 @@ replay_moment_read(char* remain, FILE* in, const char* name,
mom->evt_type = repevt_timeout;
} else if(parse_keyword(&remain, "TIME_PASSES")) {
mom->evt_type = repevt_time_passes;
while(isspace((int)*remain))
while(isspace((unsigned char)*remain))
remain++;
if(parse_keyword(&remain, "EVAL")) {
while(isspace((int)*remain))
while(isspace((unsigned char)*remain))
remain++;
mom->string = strdup(remain);
if(!mom->string) fatal_exit("out of memory");
@ -316,7 +316,7 @@ replay_moment_read(char* remain, FILE* in, const char* name,
}
} else if(parse_keyword(&remain, "CHECK_AUTOTRUST")) {
mom->evt_type = repevt_autotrust_check;
while(isspace((int)*remain))
while(isspace((unsigned char)*remain))
remain++;
if(strlen(remain)>0 && remain[strlen(remain)-1]=='\n')
remain[strlen(remain)-1] = 0;
@ -333,20 +333,20 @@ replay_moment_read(char* remain, FILE* in, const char* name,
} else if(parse_keyword(&remain, "INFRA_RTT")) {
char *s, *m;
mom->evt_type = repevt_infra_rtt;
while(isspace((int)*remain))
while(isspace((unsigned char)*remain))
remain++;
s = remain;
remain = strchr(s, ' ');
if(!remain) fatal_exit("expected three args for INFRA_RTT");
remain[0] = 0;
remain++;
while(isspace((int)*remain))
while(isspace((unsigned char)*remain))
remain++;
m = strchr(remain, ' ');
if(!m) fatal_exit("expected three args for INFRA_RTT");
m[0] = 0;
m++;
while(isspace((int)*m))
while(isspace((unsigned char)*m))
m++;
if(!extstrtoaddr(s, &mom->addr, &mom->addrlen))
fatal_exit("bad infra_rtt address %s", s);
@ -361,10 +361,10 @@ replay_moment_read(char* remain, FILE* in, const char* name,
free(mom);
return NULL;
}
while(isspace((int)*remain))
while(isspace((unsigned char)*remain))
remain++;
if(parse_keyword(&remain, "ADDRESS")) {
while(isspace((int)*remain))
while(isspace((unsigned char)*remain))
remain++;
if(strlen(remain) > 0) /* remove \n */
remain[strlen(remain)-1] = 0;
@ -408,7 +408,7 @@ static struct replay_scenario*
make_scenario(char* line)
{
struct replay_scenario* scen;
while(isspace((int)*line))
while(isspace((unsigned char)*line))
line++;
if(!*line) {
log_err("scenario: no title given");
@ -442,7 +442,7 @@ replay_scenario_read(FILE* in, const char* name, int* lineno)
parse=line;
pstate.lineno++;
(*lineno)++;
while(isspace((int)*parse))
while(isspace((unsigned char)*parse))
parse++;
if(!*parse)
continue; /* empty line */
@ -651,7 +651,7 @@ do_macro_variable(rbtree_t* store, char* buf, size_t remain)
char sv;
if(at[0]==0)
return NULL; /* no variable name after $ */
while(*at && (isalnum((int)*at) || *at=='_')) {
while(*at && (isalnum((unsigned char)*at) || *at=='_')) {
at++;
}
/* terminator, we are working in macro_expand() buffer */
@ -724,7 +724,7 @@ do_macro_arith(char* orig, size_t remain, char** arithstart)
/* remember start pos of expr, skip the first number */
at = orig;
*arithstart = at;
while(*at && (isdigit((int)*at) || *at == '.'))
while(*at && (isdigit((unsigned char)*at) || *at == '.'))
at++;
return at;
}
@ -737,7 +737,7 @@ do_macro_arith(char* orig, size_t remain, char** arithstart)
*arithstart = NULL;
return do_macro_arith(orig, remain, arithstart);
}
if(isdigit((int)operator)) {
if(isdigit((unsigned char)operator)) {
*arithstart = orig;
return at+skip; /* do nothing, but setup for later number */
}
@ -820,13 +820,13 @@ macro_expand(rbtree_t* store, struct replay_runtime* runtime, char** text)
at = do_macro_recursion(store, runtime, at, remain);
} else if(*at == '$') {
at = do_macro_variable(store, at, remain);
} else if(isdigit((int)*at)) {
} else if(isdigit((unsigned char)*at)) {
at = do_macro_arith(at, remain, &arithstart);
} else {
/* copy until whitespace or operator */
if(*at && (isalnum((int)*at) || *at=='_')) {
if(*at && (isalnum((unsigned char)*at) || *at=='_')) {
at++;
while(*at && (isalnum((int)*at) || *at=='_'))
while(*at && (isalnum((unsigned char)*at) || *at=='_'))
at++;
} else at++;
}

View file

@ -97,7 +97,7 @@ add_opts(const char* args, int* pass_argc, char* pass_argv[])
{
const char *p = args, *np;
size_t len;
while(p && isspace((int)*p))
while(p && isspace((unsigned char)*p))
p++;
while(p && *p) {
/* find location of next string and length of this one */
@ -115,7 +115,7 @@ add_opts(const char* args, int* pass_argc, char* pass_argv[])
(*pass_argc)++;
/* go to next option */
p = np;
while(p && isspace((int)*p))
while(p && isspace((unsigned char)*p))
p++;
}
}
@ -140,7 +140,7 @@ spool_auto_file(FILE* in, int* lineno, FILE* cfg, char* id)
char* parse;
FILE* spool;
/* find filename for new file */
while(isspace((int)*id))
while(isspace((unsigned char)*id))
id++;
if(strlen(id)==0)
fatal_exit("AUTROTRUST_FILE must have id, line %d", *lineno);
@ -158,7 +158,7 @@ spool_auto_file(FILE* in, int* lineno, FILE* cfg, char* id)
while(fgets(line, MAX_LINE_LEN-1, in)) {
parse = line;
(*lineno)++;
while(isspace((int)*parse))
while(isspace((unsigned char)*parse))
parse++;
if(strncmp(parse, "AUTOTRUST_END", 13) == 0) {
fclose(spool);
@ -197,7 +197,7 @@ setup_config(FILE* in, int* lineno, int* pass_argc, char* pass_argv[])
while(fgets(line, MAX_LINE_LEN-1, in)) {
parse = line;
(*lineno)++;
while(isspace((int)*parse))
while(isspace((unsigned char)*parse))
parse++;
if(!*parse || parse[0] == ';')
continue;

View file

@ -81,7 +81,7 @@ static int str_keyword(char** str, const char* keyword)
if(strncmp(*str, keyword, len) != 0)
return 0;
*str += len;
while(isspace((int)**str))
while(isspace((unsigned char)**str))
(*str)++;
return 1;
}
@ -138,7 +138,7 @@ static void matchline(char* line, struct entry* e)
error("expected = or : in MATCH: %s", line);
parse++;
e->ixfr_soa_serial = (uint32_t)strtol(parse, (char**)&parse, 10);
while(isspace((int)*parse))
while(isspace((unsigned char)*parse))
parse++;
} else {
error("could not parse MATCH: '%s'", parse);
@ -226,11 +226,11 @@ static void adjustline(char* line, struct entry* e,
e->copy_query = 1;
} else if(str_keyword(&parse, "sleep=")) {
e->sleeptime = (unsigned int) strtol(parse, (char**)&parse, 10);
while(isspace((int)*parse))
while(isspace((unsigned char)*parse))
parse++;
} else if(str_keyword(&parse, "packet_sleep=")) {
pkt->packet_sleep = (unsigned int) strtol(parse, (char**)&parse, 10);
while(isspace((int)*parse))
while(isspace((unsigned char)*parse))
parse++;
} else {
error("could not parse ADJUST: '%s'", parse);
@ -344,7 +344,7 @@ hex_buffer2wire(sldns_buffer *data_buffer)
for (data_buf_pos = 0; data_buf_pos < sldns_buffer_position(data_buffer); data_buf_pos++) {
c = (int) data_wire[data_buf_pos];
if (state < 2 && !isascii(c)) {
if (state < 2 && !isascii((unsigned char)c)) {
/*verbose("non ascii character found in file: (%d) switching to raw mode\n", c);*/
state = 2;
}
@ -422,7 +422,7 @@ get_origin(const char* name, struct sldns_file_parse_state* pstate, char* parse)
int status;
end=parse;
while(!isspace((int)*end) && !isendline(*end))
while(!isspace((unsigned char)*end) && !isendline(*end))
end++;
store = *end;
*end = 0;
@ -518,7 +518,7 @@ read_entry(FILE* in, const char* name, struct sldns_file_parse_state* pstate,
parse = line;
pstate->lineno++;
while(isspace((int)*parse))
while(isspace((unsigned char)*parse))
parse++;
/* test for keywords */
if(isendline(*parse))