diff options
Diffstat (limited to 'src/lib/libc/net/res_mkquery.c')
| -rw-r--r-- | src/lib/libc/net/res_mkquery.c | 22 | 
1 files changed, 13 insertions, 9 deletions
| diff --git a/src/lib/libc/net/res_mkquery.c b/src/lib/libc/net/res_mkquery.c index 6cd6a00dbe..bb8f1f0725 100644 --- a/src/lib/libc/net/res_mkquery.c +++ b/src/lib/libc/net/res_mkquery.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: res_mkquery.c,v 1.12 2002/08/28 03:19:38 itojun Exp $ */ | 1 | /* $OpenBSD: res_mkquery.c,v 1.13 2003/01/28 04:58:00 marc Exp $ */ | 
| 2 | 2 | ||
| 3 | /* | 3 | /* | 
| 4 | * ++Copyright++ 1985, 1993 | 4 | * ++Copyright++ 1985, 1993 | 
| @@ -60,7 +60,7 @@ | |||
| 60 | static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; | 60 | static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; | 
| 61 | static char rcsid[] = "$From: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp $"; | 61 | static char rcsid[] = "$From: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp $"; | 
| 62 | #else | 62 | #else | 
| 63 | static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.12 2002/08/28 03:19:38 itojun Exp $"; | 63 | static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.13 2003/01/28 04:58:00 marc Exp $"; | 
| 64 | #endif | 64 | #endif | 
| 65 | #endif /* LIBC_SCCS and not lint */ | 65 | #endif /* LIBC_SCCS and not lint */ | 
| 66 | 66 | ||
| @@ -74,6 +74,8 @@ static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.12 2002/08/28 03:19:38 itojun | |||
| 74 | #include <resolv.h> | 74 | #include <resolv.h> | 
| 75 | #include <string.h> | 75 | #include <string.h> | 
| 76 | 76 | ||
| 77 | #include "thread_private.h" | ||
| 78 | |||
| 77 | /* | 79 | /* | 
| 78 | * Form all types of queries. | 80 | * Form all types of queries. | 
| 79 | * Returns the size of the result or -1. | 81 | * Returns the size of the result or -1. | 
| @@ -90,17 +92,18 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) | |||
| 90 | u_char *buf; /* buffer to put query */ | 92 | u_char *buf; /* buffer to put query */ | 
| 91 | int buflen; /* size of buffer */ | 93 | int buflen; /* size of buffer */ | 
| 92 | { | 94 | { | 
| 95 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); | ||
| 93 | register HEADER *hp; | 96 | register HEADER *hp; | 
| 94 | register u_char *cp, *ep; | 97 | register u_char *cp, *ep; | 
| 95 | register int n; | 98 | register int n; | 
| 96 | u_char *dnptrs[20], **dpp, **lastdnptr; | 99 | u_char *dnptrs[20], **dpp, **lastdnptr; | 
| 97 | 100 | ||
| 98 | if ((_res.options & RES_INIT) == 0 && res_init() == -1) { | 101 | if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { | 
| 99 | h_errno = NETDB_INTERNAL; | 102 | h_errno = NETDB_INTERNAL; | 
| 100 | return (-1); | 103 | return (-1); | 
| 101 | } | 104 | } | 
| 102 | #ifdef DEBUG | 105 | #ifdef DEBUG | 
| 103 | if (_res.options & RES_DEBUG) | 106 | if (_resp->options & RES_DEBUG) | 
| 104 | printf(";; res_mkquery(%d, %s, %d, %d)\n", | 107 | printf(";; res_mkquery(%d, %s, %d, %d)\n", | 
| 105 | op, dname, class, type); | 108 | op, dname, class, type); | 
| 106 | #endif | 109 | #endif | 
| @@ -116,10 +119,10 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) | |||
| 116 | return (-1); | 119 | return (-1); | 
| 117 | bzero(buf, HFIXEDSZ); | 120 | bzero(buf, HFIXEDSZ); | 
| 118 | hp = (HEADER *) buf; | 121 | hp = (HEADER *) buf; | 
| 119 | _res.id = res_randomid(); | 122 | _resp->id = res_randomid(); | 
| 120 | hp->id = htons(_res.id); | 123 | hp->id = htons(_resp->id); | 
| 121 | hp->opcode = op; | 124 | hp->opcode = op; | 
| 122 | hp->rd = (_res.options & RES_RECURSE) != 0; | 125 | hp->rd = (_resp->options & RES_RECURSE) != 0; | 
| 123 | hp->rcode = NOERROR; | 126 | hp->rcode = NOERROR; | 
| 124 | cp = buf + HFIXEDSZ; | 127 | cp = buf + HFIXEDSZ; | 
| 125 | ep = buf + buflen; | 128 | ep = buf + buflen; | 
| @@ -203,6 +206,7 @@ res_opt(n0, buf, buflen, anslen) | |||
| 203 | int buflen; /* size of buffer */ | 206 | int buflen; /* size of buffer */ | 
| 204 | int anslen; /* answer buffer length */ | 207 | int anslen; /* answer buffer length */ | 
| 205 | { | 208 | { | 
| 209 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); | ||
| 206 | register HEADER *hp; | 210 | register HEADER *hp; | 
| 207 | register u_char *cp, *ep; | 211 | register u_char *cp, *ep; | 
| 208 | 212 | ||
| @@ -223,9 +227,9 @@ res_opt(n0, buf, buflen, anslen) | |||
| 223 | cp += INT16SZ; | 227 | cp += INT16SZ; | 
| 224 | *cp++ = NOERROR; /* extended RCODE */ | 228 | *cp++ = NOERROR; /* extended RCODE */ | 
| 225 | *cp++ = 0; /* EDNS version */ | 229 | *cp++ = 0; /* EDNS version */ | 
| 226 | if (_res.options & RES_USE_DNSSEC) { | 230 | if (_resp->options & RES_USE_DNSSEC) { | 
| 227 | #ifdef DEBUG | 231 | #ifdef DEBUG | 
| 228 | if (_res.options & RES_DEBUG) | 232 | if (_resp->options & RES_DEBUG) | 
| 229 | printf(";; res_opt()... ENDS0 DNSSEC OK\n"); | 233 | printf(";; res_opt()... ENDS0 DNSSEC OK\n"); | 
| 230 | #endif /* DEBUG */ | 234 | #endif /* DEBUG */ | 
| 231 | __putshort(DNS_MESSAGEEXTFLAG_DO, cp); /* EDNS Z field */ | 235 | __putshort(DNS_MESSAGEEXTFLAG_DO, cp); /* EDNS Z field */ | 
