Is sure that res->dnsa4_nrr is always >= 1?

Michael Tokarev mjt at tls.msk.ru
Fri Feb 4 22:22:56 MSK 2011


04.02.2011 22:16, Iñaki Baz Castillo wrote:
> Hi, if I query a non existing domain (A type) then "res" is NULL:
> 
>   res = dns_resolve_a4(NULL, "non-existing-domain.lala", 0);
> 
> res is NULL. But, could occur that res is not NULL but res->dnsa4_nrr is 0?

Before constructing return structure, the library verifies
there's at least one resource record (RR) of the requested
type.  If that's not the case, the library will return
corresponding return code -- DNS_E_NODATA.  Try to query,
for example, postfix.org A.

There may be some complications too, in case of intermediate
CNAMEs which should be resolved by the recursive resolver.

/mjt


More information about the udns mailing list