[ldns-users] How to use _searchlist provided by ldns_struct_resolver?

Zbynek Michl zbynek.michl at nic.cz
Tue Sep 14 16:46:56 UTC 2010


Hi Matthijs,

I have tried to make a dname like this:

domain = ldns_dname_new_frm_str("myhostname");
new_domain = ldns_dname_new_frm_data(ldns_rdf_size(domain) - 1,
                                      ldns_rdf_data(domain));
printf("domain: %s\n", ldns_rdf2str(domain));
printf("new_domain: %s\n", ldns_rdf2str(new_domain));

It is strange for me that both printf()s print the same result (with dot at the 
end). And then when I use:

p = ldns_resolver_search(res, new_domain, LDNS_RR_TYPE_A,
                          LDNS_RR_CLASS_IN, LDNS_RD);

resolver returns FORMERR, because ldns_resolver_search() uses ldns_rdf2str() 
which causes to call ldns_resolver_query() with incorrect domain name.


Another error of ldns_resolver_search() is that it does not check RCODE.
In case of this resolv.conf:

search mydomain.com
search mydomain.cz

and query for "myhostname" will try just first search value even if NXDOMAIN is 
returned.

Last error that I have observed is that ldns_resolver_new_frm_file() reads just 
first domain name on line, so this searchlist definition is not read completely:

search mydomain.com mydomain.cz


Regards,
Zbynek

On 12.5.2010 09:04, Matthijs Mekking wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Zbynek,
>
> Sorry for the late follow-up. You are right that making a dname from
> string always returns an absolute dname. You can try making a dname with
> ldns_dname_new_frm_data().
>
> Best regards,
>
> Matthijs
>
> Zbynek Michl wrote:
>> Hello,
>>
>> I am trying to use search list, but unsuccessfully. Here is an sample:
>>
>> --- CODE ---
>> ldns_rdf *domain = ldns_dname_new_frm_str("myhostname");
>> ldns_rdf *search = ldns_dname_new_frm_str("mydomain.cz");
>>
>> ldns_resolver_push_searchlist(res, search);
>>
>> p = ldns_resolver_search(res, domain, LDNS_RR_TYPE_A,
>>               LDNS_RR_CLASS_IN, LDNS_RD);
>> --- /CODE ---
>>
>> The problem is that "myhostname.mydomain.cz" will never be tried,
>> because of ldns_dname_new_frm_str() adds "." to the end of "myhostname"
>> and therefore ldns_resolver_search() will not concatenate "mydomain.cz".
>> So how can I create "myhostname" RDF without trailing "."? Or any other
>> suggestion?
>>
>> Cheers,
>> Zbynek
>> _______________________________________________
>> ldns-users mailing list
>> ldns-users at open.nlnetlabs.nl
>> http://open.nlnetlabs.nl/mailman/listinfo/ldns-users
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iQEcBAEBAgAGBQJL6lLsAAoJEA8yVCPsQCW5Ss8IAItekTcmCrBH/GbCYgbLIVMO
> zlydOWWoYPbwWN23uT53v6/b9GaCl85vlxQk8XizcyffFpHvNpydbLAAZQ6oF0rP
> JtzsTlR9vmNvoTfr23ZYAlALKnacDhb3W34nAFwZwoOf8KhGvI36D9IvY9NI4r/K
> bt9BQm/wGF2yyqUsCp7D8/NaHbgzP7J2hU+58A8I14cuXRGOv3KEWPHZA/hLTxfI
> B6YflGVdqBRXVKr8tkB7hc4SPwrSyaFiWEyp13fCyTzJ+uUk9xijO1Ec0QeGLd1L
> AKUQeGRs8Ci+4Xu5N37L2galQVezjFhLXTE6XGwO0yZ/9V9ZChdSoG0X1u7JiiU=
> =wPt5
> -----END PGP SIGNATURE-----



More information about the ldns-users mailing list