ares_getaddrinfo(): do not use search domains if ARES_FLAG_NOSEARCH is set#638
Merged
bradh352 merged 3 commits intoc-ares:mainfrom Nov 27, 2023
Merged
Conversation
Member
|
At first glance this seems to make sense. My guess is this probably broke in the 1.16 timeframe when getaddrinfo was introduced and gethostbyname was made as a wrapper around getaddrinfo, so I think getaddrinfo has never supported this. We probably need to add an explicit test case for this. |
Contributor
Author
|
I can also see that the condition in function as_is_first() if (hquery->name != NULL && nname && hquery->name[nname - 1] == '.') { essentially implements the logic of as_is_only() so it can be replaced by call to this function, it also makes sense as "as_is_only" should imply "as_is_first" (and only) |
Contributor
Author
petrvh
added a commit
to petrvh/c-ares
that referenced
this pull request
Nov 28, 2023
…s set (c-ares#638) - cherry picked from master
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
c-ares init options defines a flag ARES_FLAG_NOSEARCH that is supposed to prevent search using configured domain suffixes.
however when using ares_getaddrinfo() the flag was ignored and domain suffixes were used anyway.
Unfortunately explicitly configuring zero domains to search also does not work (if ndomains == 0 default domain search list is loaded regardless of the flag ARES_OPT_DOMAINS being set).
this change adds a check for the ARES_FLAG_NOSEARCH in as_is_only() function that is used by ares_getaddrinfo() to decide if to try to query next possible name ( next_dns_lookup() )