updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / qmail / qmail-1.03-bigdns.patch
blob973dd3dbd253b07f82cbbfcde8fc1099076f191d
1 diff -u --new-file qmail-1.03-orig/dns.c qmail-1.03/dns.c
2 --- qmail-1.03-orig/dns.c 2006-03-27 16:08:02.000000000 -0300
3 +++ qmail-1.03/dns.c 2006-03-27 16:10:38.000000000 -0300
4 @@ -21,10 +21,12 @@
5 static unsigned short getshort(c) unsigned char *c;
6 { unsigned short u; u = c[0]; return (u << 8) + c[1]; }
8 -static union { HEADER hdr; unsigned char buf[PACKETSZ]; } response;
9 +static struct { unsigned char *buf; } response;
10 +static int responsebuflen = 0;
11 static int responselen;
12 static unsigned char *responseend;
13 static unsigned char *responsepos;
14 +static u_long saveresoptions;
16 static int numanswers;
17 static char name[MAXDNAME];
18 @@ -45,18 +47,33 @@
19 errno = 0;
20 if (!stralloc_copy(&glue,domain)) return DNS_MEM;
21 if (!stralloc_0(&glue)) return DNS_MEM;
22 - responselen = lookup(glue.s,C_IN,type,response.buf,sizeof(response));
23 + if (!responsebuflen)
24 + if (response.buf = (unsigned char *)alloc(PACKETSZ+1))
25 + responsebuflen = PACKETSZ+1;
26 + else return DNS_MEM;
28 + responselen = lookup(glue.s,C_IN,type,response.buf,responsebuflen);
29 + if ((responselen >= responsebuflen) ||
30 + (responselen > 0 && (((HEADER *)response.buf)->tc)))
31 + {
32 + if (responsebuflen < 65536)
33 + if (alloc_re(&response.buf, responsebuflen, 65536))
34 + responsebuflen = 65536;
35 + else return DNS_MEM;
36 + saveresoptions = _res.options;
37 + _res.options |= RES_USEVC;
38 + responselen = lookup(glue.s,C_IN,type,response.buf,responsebuflen);
39 + _res.options = saveresoptions;
40 + }
41 if (responselen <= 0)
43 if (errno == ECONNREFUSED) return DNS_SOFT;
44 if (h_errno == TRY_AGAIN) return DNS_SOFT;
45 return DNS_HARD;
47 - if (responselen >= sizeof(response))
48 - responselen = sizeof(response);
49 responseend = response.buf + responselen;
50 responsepos = response.buf + sizeof(HEADER);
51 - n = ntohs(response.hdr.qdcount);
52 + n = ntohs(((HEADER *)response.buf)->qdcount);
53 while (n-- > 0)
55 i = dn_expand(response.buf,responseend,responsepos,name,MAXDNAME);
56 @@ -66,7 +83,7 @@
57 if (i < QFIXEDSZ) return DNS_SOFT;
58 responsepos += QFIXEDSZ;
60 - numanswers = ntohs(response.hdr.ancount);
61 + numanswers = ntohs(((HEADER *)response.buf)->ancount);
62 return 0;
65 Subdirectorios comunes: qmail-1.03-orig/qmail-rhinit y qmail-1.03/qmail-rhinit