diff options
author | peter <peter@FreeBSD.org> | 1995-08-20 20:03:06 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1995-08-20 20:03:06 +0000 |
commit | bbe6ab41603ea223c7c921bd48586ed795917870 (patch) | |
tree | 32821775fcd4108257c3d49593dadeb5a5f18b17 /lib/libc/net/res_mkquery.c | |
parent | 2dd1919d1c22bd3dc75ab1064352572d401b1ab9 (diff) | |
download | FreeBSD-src-bbe6ab41603ea223c7c921bd48586ed795917870.zip FreeBSD-src-bbe6ab41603ea223c7c921bd48586ed795917870.tar.gz |
Update the resolver part of libc to bind-4.9.3-beta24 level (from beta9p1)
Note that this was done by selective patching from diffs, to not conflict
with the 4.4bsd base code.. This was *not* a trivial task.. I have been
testing this code (apart from cosmetic changes) in my libc for a while now.
Obtained from: Paul Vixie <paul@vix.com>
Diffstat (limited to 'lib/libc/net/res_mkquery.c')
-rw-r--r-- | lib/libc/net/res_mkquery.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/libc/net/res_mkquery.c b/lib/libc/net/res_mkquery.c index 7788d16..979abbd 100644 --- a/lib/libc/net/res_mkquery.c +++ b/lib/libc/net/res_mkquery.c @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: res_mkquery.c,v 1.3 1994/09/25 17:45:39 pst Exp $"; +static char rcsid[] = "$Id: res_mkquery.c,v 1.4 1995/05/30 05:40:56 rgrimes Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -63,6 +63,10 @@ static char rcsid[] = "$Id: res_mkquery.c,v 1.3 1994/09/25 17:45:39 pst Exp $"; #include <stdio.h> #include <resolv.h> #include <string.h> +#include <netdb.h> + +#include <res_config.h> + /* * Form all types of queries. @@ -82,12 +86,20 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) register HEADER *hp; register u_char *cp; register int n; +#ifdef ALLOW_UPDATES struct rrec *newrr = (struct rrec *) newrr_in; +#endif u_char *dnptrs[20], **dpp, **lastdnptr; + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (-1); + } +#ifdef DEBUG if (_res.options & RES_DEBUG) printf(";; res_mkquery(%d, %s, %d, %d)\n", op, dname, class, type); +#endif /* * Initialize header fields. */ @@ -97,7 +109,6 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) hp = (HEADER *) buf; hp->id = htons(++_res.id); hp->opcode = op; - hp->pr = (_res.options & RES_PRIMARY) != 0; hp->rd = (_res.options & RES_RECURSE) != 0; hp->rcode = NOERROR; cp = buf + HFIXEDSZ; @@ -110,7 +121,8 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) * perform opcode specific processing */ switch (op) { - case QUERY: + case QUERY: /*FALLTHROUGH*/ + case NS_NOTIFY_OP: if ((buflen -= QFIXEDSZ) < 0) return(-1); if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0) @@ -222,8 +234,9 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) } hp->ancount = htons(0); break; - #endif /* ALLOW_UPDATES */ + default: + return (-1); } return (cp - buf); } |