Author: phater Date: Fri Jul 14 16:05:31 2017 New Revision: 75339 URL: http://svn.reactos.org/svn/reactos?rev=75339&view=rev Log: [ADNS] Add function to return number of DNS servers available for query. [DNSAPI] Use newly added function to return without search if no DNS servers are available. CORE-13441 #resolve
Modified: trunk/reactos/dll/win32/dnsapi/dnsapi/query.c trunk/reactos/sdk/lib/3rdparty/adns/src/adns.h trunk/reactos/sdk/lib/3rdparty/adns/src/setup.c Modified: trunk/reactos/dll/win32/dnsapi/dnsapi/query.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dnsapi/dnsapi/query.c?rev=75339&r1=75338&r2=75339&view=diff ============================================================================== --- trunk/reactos/dll/win32/dnsapi/dnsapi/query.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/dnsapi/dnsapi/query.c [iso-8859-1] Fri Jul 14 16:05:31 2017 @@ -798,6 +798,14 @@ } } + if (!adns_numservers(astate)) + { + /* There are no servers to query so bail out */ + adns_finish(astate); + RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName); + return ERROR_FILE_NOT_FOUND; + } + /* * adns doesn't resolve chained CNAME records (a CNAME which points to * another CNAME pointing to another... pointing to an A record), according Modified: trunk/reactos/sdk/lib/3rdparty/adns/src/adns.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/adns/src/adns.h?rev=75339&r1=75338&r2=75339&view=diff ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/adns/src/adns.h [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/adns/src/adns.h [iso-8859-1] Fri Jul 14 16:05:31 2017 @@ -368,7 +368,11 @@ /* ReactOS addition */ ADNS_API void adns_addserver(adns_state state, struct in_addr server); -ADNS_API void adns_ccf_search(adns_state ads, const char *fn, int lno, const char *buf); +ADNS_API void adns_ccf_search(adns_state state, + const char *fn, + int lno, + const char *buf); +ADNS_API int adns_numservers(adns_state state); ADNS_API int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags, FILE *diagfile /*0=>discard*/, const char *configtext); Modified: trunk/reactos/sdk/lib/3rdparty/adns/src/setup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/adns/src/setup.c?rev=75339&r1=75338&r2=75339&view=diff ============================================================================== --- trunk/reactos/sdk/lib/3rdparty/adns/src/setup.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/adns/src/setup.c [iso-8859-1] Fri Jul 14 16:05:31 2017 @@ -715,3 +715,6 @@ void adns_ccf_search(adns_state ads, const char *fn, int lno, const char *buf) { ccf_search(ads, fn, lno, buf); } +int adns_numservers(adns_state ads) { + return ads->nservers; +}