finding authoritative nameservers

Mark Andrews Mark_Andrews at isc.org
Tue May 20 03:21:35 UTC 2008


> 
> In message <200805200216.m4K2GH8b029862 at drugs.dv.isc.org>, 
> Mark Andrews <Mark_Andrews at isc.org> wrote:
> 
> >> In message <200805200014.m4K0E1HR028826 at drugs.dv.isc.org>, 
> >> Mark Andrews <Mark_Andrews at isc.org> wrote:
> >> 
> >> >	res_findzonecut().
> >> ...
> >> Sigh.  So close, yet so far.
> >
> >	So ask for the NS records once you have the zone name.
> 
> OK.  How?  I really do not know how.  Please enlighten me.

#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>

main(int argc, char **argv) {
        char zonename[MAXDNAME];
        unsigned char buf[0xffff];
        int n;


        if (!argv[1])
                exit (0);
        n = res_init();
        if (n > 0)
                n = res_findzonecut(&_res, argv[1], C_IN, 0,
                                    zonename, sizeof(zonename), NULL, 0);
        if (n > 0)
                n = res_query(zonename, C_IN, T_NS, buf, sizeof(buf));
}

 
> >	This really is not a major issue.
> 
> Depends on where one sits, I guess.
> 
> >	You complained about res_query() before not giving you what
> >	you want.
> 
> I remarked about it.  I did not "complain".
> 
> >  res_query() is only a wrapper around res_mkquery()
> >	and res_send()
> 
> Not quite.  (I'm looking at the code, and there's a bit more to it than
> ust that.)
> 
> >       The functions are there.  You just need to choose the right
> >	ones to do the job you want done.
> 
> I'm all ears.
> 
> 
-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark_Andrews at isc.org


More information about the bind-users mailing list