Changeset 974

Show
Ignore:
Timestamp:
03/18/07 13:44:12 (6 years ago)
Author:
ahu
Message:

close ticket #130 - unable to send servfail, thanks to ch

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/dnspacket.cc

    r972 r974  
    310310  DNSPacketWriter pw(packet, qdomain, qtype.getCode(), 1); 
    311311 
     312  pw.getHeader()->rcode=d.rcode; 
    312313  pw.getHeader()->aa=d.aa; 
    313314  pw.getHeader()->ra=d.ra; 
     
    316317  pw.getHeader()->rd=d.rd; 
    317318 
    318   for(pos=rrs.begin();pos<rrs.end();++pos) { 
    319     // this needs to deal with the 'prio' mismatch! 
    320     if(pos->qtype.getCode()==QType::MX || pos->qtype.getCode() == QType::SRV) {   
    321       pos->content = lexical_cast<string>(pos->priority) + " " + pos->content; 
    322     } 
    323     pw.startRecord(pos->qname, pos->qtype.getCode(), pos->ttl, 1, (DNSPacketWriter::Place)pos->d_place);  
    324     shared_ptr<DNSRecordContent> drc(DNSRecordContent::mastermake(pos->qtype.getCode(), 1, pos->content));  
    325     drc->toPacket(pw); 
    326   } 
    327   try { 
    328     pw.commit(); 
    329   } 
    330   catch(exception& e) { 
    331     cerr<<"Exception: "<<e.what()<<endl; 
    332     throw; 
     319  if(!rrs.empty()) { 
     320    for(pos=rrs.begin();pos<rrs.end();++pos) { 
     321      // this needs to deal with the 'prio' mismatch! 
     322      if(pos->qtype.getCode()==QType::MX || pos->qtype.getCode() == QType::SRV) {   
     323        pos->content = lexical_cast<string>(pos->priority) + " " + pos->content; 
     324      } 
     325      pw.startRecord(pos->qname, pos->qtype.getCode(), pos->ttl, 1, (DNSPacketWriter::Place)pos->d_place);  
     326      shared_ptr<DNSRecordContent> drc(DNSRecordContent::mastermake(pos->qtype.getCode(), 1, pos->content));  
     327      drc->toPacket(pw); 
     328    } 
     329    try { 
     330      pw.commit(); 
     331    } 
     332    catch(exception& e) { 
     333      cerr<<"Exception: "<<e.what()<<endl; 
     334      throw; 
     335    } 
    333336  } 
    334337  stringbuffer.assign((char*)&packet[0], packet.size());