res_send() doesn't work with osquery enabled

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Aug 26 17:55:00 GMT 2010


On Aug 26 13:16, Pierre A. Humblet wrote:
> ----- Original Message ----- 
> From: "Corinna Vinschen" 
> To: <cygwin-patches>
> Sent: Thursday, August 26, 2010 12:38
> 
> 
> | Pierre, would you mind to take a look?
> | 
> | On Aug 26 19:07, pseudo@egg6.net wrote:
> | > Currently res_init() checks for availability of the native windows
> | > function DnsQuery_A. If the function is found, it's preferred over the
> | > cygwin implementation and res_query is set up to use it.
> | > As DnsQuery_A finds the configured name servers itself, the current code
> | > assumes we can avoid loading the dns server list with GetNetworkParams().
> | > 
> | > However, the assumption that everybody would use res_query is wrong. Some
> | > programs may use res_mkquery() and res_send() or may only read the list of
> | > servers from _res.nsaddr_list and send/receive the queries/replies
> | > themselves. res_send() also relies on nsaddr_list.
> 
> It's true that the behavior described above is legitimate, even if nobody had ever 
> requested it. If people want to access nsaddr_list after calling res_ninit, loading 
> iphlpapi.dll every time (as the patch does) is unavoidable.
> 
> The other change has res_nsend return an error if no server can be found.
> Alternatively the error could be reported by res_ninit, by removing the second
> condition in 
> if (statp->nscount == 0 && !statp->os_query) {
>     errno = ENONET;
>     statp->res_h_errno = NETDB_INTERNAL;
> 
> Hypothetically this could affect some installations where iphlpapi doesn't report any
> servers although the Windows resolver can find a server (but I don't see how this
> could happen), so it's safer to proceed as in the patch.
> However the patch should send errno to ENONET and set res_h_errno to
> NETDB_INTERNAL
> 
> Except for the previous comment, I am fine with the patch.

IIRC you have checkin rights, Pierre.  Please apply whatever you
think is right.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-patches mailing list