source:
npl/mailserver/netqmail/qmail-103.patch
@
0105685
Last change on this file since 0105685 was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 2.1 KB |
-
qmail-1.03/dns.c
old new 21 21 static unsigned short getshort(c) unsigned char *c; 22 22 { unsigned short u; u = c[0]; return (u << 8) + c[1]; } 23 23 24 static union { HEADER hdr; unsigned char buf[PACKETSZ]; } response; 24 static struct { unsigned char *buf; } response; 25 static int responsebuflen = 0; 25 26 static int responselen; 26 27 static unsigned char *responseend; 27 28 static unsigned char *responsepos; 29 static u_long saveresoptions; 28 30 29 31 static int numanswers; 30 32 static char name[MAXDNAME]; … … 45 47 errno = 0; 46 48 if (!stralloc_copy(&glue,domain)) return DNS_MEM; 47 49 if (!stralloc_0(&glue)) return DNS_MEM; 48 responselen = lookup(glue.s,C_IN,type,response.buf,sizeof(response)); 50 if (!responsebuflen) 51 if (response.buf = (unsigned char *)alloc(PACKETSZ+1)) 52 responsebuflen = PACKETSZ+1; 53 else return DNS_MEM; 54 55 responselen = lookup(glue.s,C_IN,type,response.buf,responsebuflen); 56 if ((responselen >= responsebuflen) || 57 (responselen > 0 && (((HEADER *)response.buf)->tc))) 58 { 59 if (responsebuflen < 65536) 60 if (alloc_re(&response.buf, responsebuflen, 65536)) 61 responsebuflen = 65536; 62 else return DNS_MEM; 63 saveresoptions = _res.options; 64 _res.options |= RES_USEVC; 65 responselen = lookup(glue.s,C_IN,type,response.buf,responsebuflen); 66 _res.options = saveresoptions; 67 } 49 68 if (responselen <= 0) 50 69 { 51 70 if (errno == ECONNREFUSED) return DNS_SOFT; 52 71 if (h_errno == TRY_AGAIN) return DNS_SOFT; 53 72 return DNS_HARD; 54 73 } 55 if (responselen >= sizeof(response))56 responselen = sizeof(response);57 74 responseend = response.buf + responselen; 58 75 responsepos = response.buf + sizeof(HEADER); 59 n = ntohs( response.hdr.qdcount);76 n = ntohs(((HEADER *)response.buf)->qdcount); 60 77 while (n-- > 0) 61 78 { 62 79 i = dn_expand(response.buf,responseend,responsepos,name,MAXDNAME); … … 66 83 if (i < QFIXEDSZ) return DNS_SOFT; 67 84 responsepos += QFIXEDSZ; 68 85 } 69 numanswers = ntohs( response.hdr.ancount);86 numanswers = ntohs(((HEADER *)response.buf)->ancount); 70 87 return 0; 71 88 } 72 89
Note: See TracBrowser
for help on using the repository browser.