Merge branch 'devel/std-suffix-handling' into release/v1.0.0beta

This commit is contained in:
Willem Toorop 2016-03-24 16:53:05 +01:00
commit 4187636f41
7 changed files with 17 additions and 4 deletions

View File

@ -48,6 +48,7 @@ static struct const_info consts_info[] = {
{ 551, "GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE", GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE_TEXT }, { 551, "GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE", GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE_TEXT },
{ 552, "GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE", GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE_TEXT }, { 552, "GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE", GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE_TEXT },
{ 553, "GETDNS_APPEND_NAME_NEVER", GETDNS_APPEND_NAME_NEVER_TEXT }, { 553, "GETDNS_APPEND_NAME_NEVER", GETDNS_APPEND_NAME_NEVER_TEXT },
{ 554, "GETDNS_APPEND_NAME_TO_SINGLE_LABEL_FIRST", GETDNS_APPEND_NAME_TO_SINGLE_LABEL_FIRST_TEXT },
{ 600, "GETDNS_CONTEXT_CODE_NAMESPACES", GETDNS_CONTEXT_CODE_NAMESPACES_TEXT }, { 600, "GETDNS_CONTEXT_CODE_NAMESPACES", GETDNS_CONTEXT_CODE_NAMESPACES_TEXT },
{ 601, "GETDNS_CONTEXT_CODE_RESOLUTION_TYPE", GETDNS_CONTEXT_CODE_RESOLUTION_TYPE_TEXT }, { 601, "GETDNS_CONTEXT_CODE_RESOLUTION_TYPE", GETDNS_CONTEXT_CODE_RESOLUTION_TYPE_TEXT },
{ 602, "GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS", GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS_TEXT }, { 602, "GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS", GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS_TEXT },

View File

@ -1213,7 +1213,7 @@ getdns_context_create_with_extended_memory_functions(
#if defined(HAVE_LIBUNBOUND) && !defined(HAVE_UB_CTX_SET_STUB) #if defined(HAVE_LIBUNBOUND) && !defined(HAVE_UB_CTX_SET_STUB)
result->root_servers_fn[0] = 0; result->root_servers_fn[0] = 0;
#endif #endif
result->append_name = GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE; result->append_name = GETDNS_APPEND_NAME_TO_SINGLE_LABEL_FIRST;
result->suffixes = no_suffixes; result->suffixes = no_suffixes;
result->suffixes_len = sizeof(no_suffixes); result->suffixes_len = sizeof(no_suffixes);

View File

@ -191,6 +191,8 @@ _getdns_check_dns_req_complete(getdns_dns_req *dns_req)
} }
} while (dns_req->suffix_len > 1 && *dns_req->suffix); } while (dns_req->suffix_len > 1 && *dns_req->suffix);
if (dns_req->append_name == GETDNS_APPEND_NAME_ALWAYS || if (dns_req->append_name == GETDNS_APPEND_NAME_ALWAYS ||
dns_req->append_name ==
GETDNS_APPEND_NAME_TO_SINGLE_LABEL_FIRST ||
(dns_req->suffix_len > 1 && *dns_req->suffix)) { (dns_req->suffix_len > 1 && *dns_req->suffix)) {
for ( netreq_p = dns_req->netreqs for ( netreq_p = dns_req->netreqs
; (netreq = *netreq_p) ; (netreq = *netreq_p)

View File

@ -814,6 +814,9 @@ getdns_validate_dnssec2(getdns_list *to_validate,
time_t validation_time, uint32_t skew); time_t validation_time, uint32_t skew);
#define GETDNS_APPEND_NAME_TO_SINGLE_LABEL_FIRST ((getdns_append_name_t) 554 )
#define GETDNS_APPEND_NAME_TO_SINGLE_LABEL_FIRST_TEXT "See getdns_context_set_append_name()"
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -12,7 +12,7 @@ cat > const-info.c << END_OF_HEAD
static struct const_info consts_info[] = { static struct const_info consts_info[] = {
{ -1, NULL, "/* <unknown getdns value> */" }, { -1, NULL, "/* <unknown getdns value> */" },
END_OF_HEAD END_OF_HEAD
gawk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ key = sprintf("%4d", $3); consts[key] = $1; }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/^#define GETDNS_RRTYPE/ && !/^#define GETDNS_RRCLASS/ && !/^#define GETDNS_OPCODE/ && !/^#define GETDNS_RCODE/ && !/_TEXT/{ key = sprintf("%4d", $3); consts[key] = $2; }/^#define GETDNS_[A-Z_]+[ ]+\(\(getdns_return_t) [0-9]+ \)/{ key = sprintf("%4d", $4); consts[key] = $2; }END{ n = asorti(consts, const_vals); for ( i = 1; i <= n; i++) { val = const_vals[i]; name = consts[val]; print "\t{ "val", \""name"\", "name"_TEXT },"}}' getdns/getdns.h.in getdns/getdns_extra.h.in | sed 's/,,/,/g' >> const-info.c gawk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ key = sprintf("%4d", $3); consts[key] = $1; }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/^#define GETDNS_RRTYPE/ && !/^#define GETDNS_RRCLASS/ && !/^#define GETDNS_OPCODE/ && !/^#define GETDNS_RCODE/ && !/_TEXT/{ key = sprintf("%4d", $3); consts[key] = $2; }/^#define GETDNS_[A-Z_]+[ ]+\(\(getdns_(return|append_name)_t) [0-9]+ \)/{ key = sprintf("%4d", $4); consts[key] = $2; }END{ n = asorti(consts, const_vals); for ( i = 1; i <= n; i++) { val = const_vals[i]; name = consts[val]; print "\t{ "val", \""name"\", "name"_TEXT },"}}' getdns/getdns.h.in getdns/getdns_extra.h.in | sed 's/,,/,/g' >> const-info.c
cat >> const-info.c << END_OF_TAIL cat >> const-info.c << END_OF_TAIL
}; };

View File

@ -830,7 +830,9 @@ _getdns_dns_req_new(getdns_context *context, getdns_eventloop *loop,
GETDNS_FREE(result->my_mf, result); GETDNS_FREE(result->my_mf, result);
return NULL; return NULL;
} }
if (result->append_name == GETDNS_APPEND_NAME_ALWAYS) { if (result->append_name == GETDNS_APPEND_NAME_ALWAYS ||
( result->append_name == GETDNS_APPEND_NAME_TO_SINGLE_LABEL_FIRST
&& result->name[0] && result->name[result->name[0]+1] == 0)){
for ( for (
; result->suffix_len > 1 && *result->suffix ; result->suffix_len > 1 && *result->suffix
; result->suffix += result->suffix_len ; result->suffix += result->suffix_len

View File

@ -520,7 +520,8 @@ print_usage(FILE *out, const char *progname)
fprintf(out, "\t-x\tDo not follow redirects\n"); fprintf(out, "\t-x\tDo not follow redirects\n");
fprintf(out, "\t-X\tFollow redirects (default)\n"); fprintf(out, "\t-X\tFollow redirects (default)\n");
fprintf(out, "\t-W\tAppend suffix always (default)\n"); fprintf(out, "\t-0\tAppend suffix to single label first (default)\n");
fprintf(out, "\t-W\tAppend suffix always\n");
fprintf(out, "\t-1\tAppend suffix only to single label after failure\n"); fprintf(out, "\t-1\tAppend suffix only to single label after failure\n");
fprintf(out, "\t-M\tAppend suffix only to multi label name after failure\n"); fprintf(out, "\t-M\tAppend suffix only to multi label name after failure\n");
fprintf(out, "\t-N\tNever append a suffix\n"); fprintf(out, "\t-N\tNever append a suffix\n");
@ -1043,6 +1044,10 @@ getdns_return_t parse_args(int argc, char **argv)
(void) getdns_context_set_append_name(context, (void) getdns_context_set_append_name(context,
GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE); GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE);
break; break;
case '0':
(void) getdns_context_set_append_name(context,
GETDNS_APPEND_NAME_TO_SINGLE_LABEL_FIRST);
break;
case 'M': case 'M':
(void) getdns_context_set_append_name(context, (void) getdns_context_set_append_name(context,
GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE); GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE);