diff --git a/src/const-info.c b/src/const-info.c index 1288061c..5a25dd83 100644 --- a/src/const-info.c +++ b/src/const-info.c @@ -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 }, { 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 }, + { 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 }, { 601, "GETDNS_CONTEXT_CODE_RESOLUTION_TYPE", GETDNS_CONTEXT_CODE_RESOLUTION_TYPE_TEXT }, { 602, "GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS", GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS_TEXT }, diff --git a/src/context.c b/src/context.c index ba2096f9..87f56a8f 100644 --- a/src/context.c +++ b/src/context.c @@ -1197,7 +1197,7 @@ getdns_context_create_with_extended_memory_functions( #if defined(HAVE_LIBUNBOUND) && !defined(HAVE_UB_CTX_SET_STUB) result->root_servers_fn[0] = 0; #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_len = sizeof(no_suffixes); diff --git a/src/general.c b/src/general.c index aed20f1c..509d7012 100644 --- a/src/general.c +++ b/src/general.c @@ -191,6 +191,8 @@ _getdns_check_dns_req_complete(getdns_dns_req *dns_req) } } while (dns_req->suffix_len > 1 && *dns_req->suffix); 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)) { for ( netreq_p = dns_req->netreqs ; (netreq = *netreq_p) diff --git a/src/getdns/getdns_extra.h.in b/src/getdns/getdns_extra.h.in index 65174717..dd0574c7 100644 --- a/src/getdns/getdns_extra.h.in +++ b/src/getdns/getdns_extra.h.in @@ -814,6 +814,9 @@ getdns_validate_dnssec2(getdns_list *to_validate, 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 } diff --git a/src/mk-const-info.c.sh b/src/mk-const-info.c.sh index 1bf7927f..631b89c6 100755 --- a/src/mk-const-info.c.sh +++ b/src/mk-const-info.c.sh @@ -12,7 +12,7 @@ cat > const-info.c << END_OF_HEAD static struct const_info consts_info[] = { { -1, NULL, "/* */" }, 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 }; diff --git a/src/request-internal.c b/src/request-internal.c index 69a6718c..7b71a96d 100644 --- a/src/request-internal.c +++ b/src/request-internal.c @@ -828,7 +828,9 @@ _getdns_dns_req_new(getdns_context *context, getdns_eventloop *loop, GETDNS_FREE(result->my_mf, result); 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 ( ; result->suffix_len > 1 && *result->suffix ; result->suffix += result->suffix_len