source:
npl/internetserver/djbdns/CVE2008-4392_0002-dnscache-cache-soa-records.patch
@
9c8fcb1
Last change on this file since 9c8fcb1 was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 2.9 KB |
-
query.c
diff --git a/query.c b/query.c index 46cdc00..4574e97 100644
a b static int doit(struct query *z,int state) 319 319 } 320 320 } 321 321 322 if (typematch(DNS_T_SOA,dtype)) { 323 byte_copy(key,2,DNS_T_SOA); 324 cached = cache_get(key,dlen + 2,&cachedlen,&ttl); 325 if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) { 326 log_cachedanswer(d,DNS_T_SOA); 327 if (!rqa(z)) goto DIE; 328 pos = 0; 329 while (pos = dns_packet_copy(cached,cachedlen,pos,misc,20)) { 330 pos = dns_packet_getname(cached,cachedlen,pos,&t2); 331 if (!pos) break; 332 pos = dns_packet_getname(cached,cachedlen,pos,&t3); 333 if (!pos) break; 334 if (!response_rstart(d,DNS_T_SOA,ttl)) goto DIE; 335 if (!response_addname(t2)) goto DIE; 336 if (!response_addname(t3)) goto DIE; 337 if (!response_addbytes(misc,20)) goto DIE; 338 response_rfinish(RESPONSE_ANSWER); 339 } 340 cleanup(z); 341 return 1; 342 } 343 } 344 322 345 if (typematch(DNS_T_A,dtype)) { 323 346 byte_copy(key,2,DNS_T_A); 324 347 cached = cache_get(key,dlen + 2,&cachedlen,&ttl); … … static int doit(struct query *z,int state) 351 374 } 352 375 } 353 376 354 if (!typematch(DNS_T_ANY,dtype) && !typematch(DNS_T_AXFR,dtype) && !typematch(DNS_T_CNAME,dtype) && !typematch(DNS_T_NS,dtype) && !typematch(DNS_T_PTR,dtype) && !typematch(DNS_T_A,dtype) && !typematch(DNS_T_MX,dtype) ) {377 if (!typematch(DNS_T_ANY,dtype) && !typematch(DNS_T_AXFR,dtype) && !typematch(DNS_T_CNAME,dtype) && !typematch(DNS_T_NS,dtype) && !typematch(DNS_T_PTR,dtype) && !typematch(DNS_T_A,dtype) && !typematch(DNS_T_MX,dtype) && !typematch(DNS_T_SOA,dtype)) { 355 378 byte_copy(key,2,dtype); 356 379 cached = cache_get(key,dlen + 2,&cachedlen,&ttl); 357 380 if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) { … … static int doit(struct query *z,int state) 585 608 else if (byte_equal(type,2,DNS_T_AXFR)) 586 609 ; 587 610 else if (byte_equal(type,2,DNS_T_SOA)) { 611 int non_authority = 0; 612 save_start(); 588 613 while (i < j) { 589 614 pos = dns_packet_skipname(buf,len,records[i]); if (!pos) goto DIE; 590 615 pos = dns_packet_getname(buf,len,pos + 10,&t2); if (!pos) goto DIE; 591 616 pos = dns_packet_getname(buf,len,pos,&t3); if (!pos) goto DIE; 592 617 pos = dns_packet_copy(buf,len,pos,misc,20); if (!pos) goto DIE; 593 if (records[i] < posauthority) 618 if (records[i] < posauthority) { 594 619 log_rrsoa(whichserver,t1,t2,t3,misc,ttl); 620 save_data(misc,20); 621 save_data(t2,dns_domain_length(t2)); 622 save_data(t3,dns_domain_length(t3)); 623 non_authority++; 624 } 595 625 ++i; 596 626 } 627 if (non_authority) 628 save_finish(DNS_T_SOA,t1,ttl); 597 629 } 598 630 else if (byte_equal(type,2,DNS_T_CNAME)) { 599 631 pos = dns_packet_skipname(buf,len,records[j - 1]); if (!pos) goto DIE;
Note: See TracBrowser
for help on using the repository browser.