1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
$NetBSD: patch-ac,v 1.14 2010/11/08 13:59:11 adam Exp $
--- src/dns.c.orig 2009-11-16 19:50:36.000000000 +0000
+++ src/dns.c
@@ -168,18 +168,34 @@ Returns: nothing
void
dns_init(BOOL qualify_single, BOOL search_parents)
{
-if ((_res.options & RES_INIT) == 0)
+struct __res_state *rs;
+#ifdef __NetBSD__
+rs = __res_get_state();
+#else
+rs = &_res;
+#endif
+
+if ((rs->options & RES_INIT) == 0)
{
- DEBUG(D_resolver) _res.options |= RES_DEBUG; /* For Cygwin */
+ DEBUG(D_resolver) rs->options |= RES_DEBUG; /* For Cygwin */
+ #ifdef __NetBSD__
+ __res_put_state(rs);
+ #endif
res_init();
- DEBUG(D_resolver) _res.options |= RES_DEBUG;
+ DEBUG(D_resolver) rs->options |= RES_DEBUG;
+ #ifdef __NetBSD__
+ __res_put_state(rs);
+ #endif
}
-_res.options &= ~(RES_DNSRCH | RES_DEFNAMES);
-_res.options |= (qualify_single? RES_DEFNAMES : 0) |
+rs->options &= ~(RES_DNSRCH | RES_DEFNAMES);
+rs->options |= (qualify_single? RES_DEFNAMES : 0) |
(search_parents? RES_DNSRCH : 0);
-if (dns_retrans > 0) _res.retrans = dns_retrans;
-if (dns_retry > 0) _res.retry = dns_retry;
+if (dns_retrans > 0) rs->retrans = dns_retrans;
+if (dns_retry > 0) rs->retry = dns_retry;
+#ifdef __NetBSD__
+__res_put_state(rs);
+#endif
}
@@ -424,9 +440,15 @@ Returns: the return code
static int
dns_return(uschar *name, int type, int rc)
{
+struct __res_state *rs;
+#ifdef __NetBSD__
+rs = __res_get_state();
+#else
+rs = &_res;
+#endif
tree_node *node = store_get_perm(sizeof(tree_node) + 290);
sprintf(CS node->name, "%.255s-%s-%lx", name, dns_text_type(type),
- _res.options);
+ rs->options);
node->data.val = rc;
(void)tree_insertnode(&tree_dns_fails, node);
return rc;
@@ -466,6 +488,12 @@ dns_basic_lookup(dns_answer *dnsa, uscha
int rc = -1;
uschar *save;
#endif
+struct __res_state *rs;
+#ifdef __NetBSD__
+rs = __res_get_state();
+#else
+rs = &_res;
+#endif
tree_node *previous;
uschar node_name[290];
@@ -476,7 +504,7 @@ have many addresses in the same domain.
caching for successful lookups. */
sprintf(CS node_name, "%.255s-%s-%lx", name, dns_text_type(type),
- _res.options);
+ rs->options);
previous = tree_search(tree_dns_fails, node_name);
if (previous != NULL)
{
|