// SOA needs stripping too! XXX FIXME - also, this should not be here I think
switch(r.qtype.getCode()) {
case QType::MX:
- if(!stripDomainSuffix(&content, domain))
- content+=".";
- *d_of<<qname<<"\t"<<r.ttl<<"\t"<<r.qtype.getName()<<"\t"<<r.priority<<"\t"<<content<<endl;
- break;
case QType::SRV:
- if(!stripDomainSuffix(&content, domain))
- content+=".";
- *d_of<<qname<<"\t"<<r.ttl<<"\t"<<r.qtype.getName()<<"\t"<<r.priority<<"\t"<<content<<endl;
- break;
case QType::CNAME:
case QType::NS:
if(!stripDomainSuffix(&content, domain))
else
hashed="";
}
- insertRecord(*bbd, rr.qname, rr.qtype, rr.content, rr.ttl, rr.priority, hashed);
+ insertRecord(*bbd, rr.qname, rr.qtype, rr.content, rr.ttl, hashed);
}
fixupAuth(bbd->d_records.getWRITABLE());
doEmptyNonTerminals(*bbd, nsec3zone, ns3pr);
/** THIS IS AN INTERNAL FUNCTION! It does moadnsparser prio impedance matching
Much of the complication is due to the efforts to benefit from std::string reference counting copy on write semantics */
-void Bind2Backend::insertRecord(BB2DomainInfo& bb2, const string &qnameu, const QType &qtype, const string &content, int ttl, int prio, const std::string& hashed, bool *auth)
+void Bind2Backend::insertRecord(BB2DomainInfo& bb2, const string &qnameu, const QType &qtype, const string &content, int ttl, const std::string& hashed, bool *auth)
{
Bind2DNSRecord bdr;
shared_ptr<recordstorage_t> records = bb2.d_records.getWRITABLE();
else
bdr.auth=true;
- if(bdr.qtype == QType::MX || bdr.qtype == QType::SRV) {
- prio=atoi(bdr.content.c_str());
-
- string::size_type pos = bdr.content.find_first_not_of("0123456789");
- if(pos != string::npos)
- boost::erase_head(bdr.content, pos);
- trim_left(bdr.content);
- }
-
if(bdr.qtype==QType::CNAME || bdr.qtype==QType::MX || bdr.qtype==QType::NS || bdr.qtype==QType::AFSDB)
bdr.content=toLowerCanonic(bdr.content); // I think this is wrong, the zoneparser should not come up with . terminated stuff XXX FIXME
bdr.ttl=ttl;
- bdr.priority=prio;
records->insert(bdr);
}
rr.qtype="#0";
rr.content="";
rr.ttl=0;
- rr.priority=0;
pair<string, bool> nt;
BOOST_FOREACH(nt, nonterm)
{
rr.qname=nt.first+"."+bbd.d_name+".";
if(nsec3zone)
hashed=toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname));
- insertRecord(bbd, rr.qname, rr.qtype, rr.content, rr.ttl, rr.priority, hashed, &nt.second);
+ insertRecord(bbd, rr.qname, rr.qtype, rr.content, rr.ttl, hashed, &nt.second);
}
}
return false;
}
if(d_handle.mustlog)
- L<<Logger::Warning<<"Returning: '"<<r.qtype.getName()<<"' of '"<<r.qname<<"', content: '"<<r.content<<"', prio: "<<r.priority<<endl;
+ L<<Logger::Warning<<"Returning: '"<<r.qtype.getName()<<"' of '"<<r.qname<<"', content: '"<<r.content<<"'"<<endl;
return true;
}
// r.domain_id=(d_iter)->domain_id;
r.qtype=(d_iter)->qtype;
r.ttl=(d_iter)->ttl;
- r.priority=(d_iter)->priority;
//if(!d_iter->auth && r.qtype.getCode() != QType::A && r.qtype.getCode()!=QType::AAAA && r.qtype.getCode() != QType::NS)
// cerr<<"Warning! Unauth response for qtype "<< r.qtype.getName() << " for '"<<r.qname<<"'"<<endl;
r.content=(d_qname_iter)->content;
r.qtype=(d_qname_iter)->qtype;
r.ttl=(d_qname_iter)->ttl;
- r.priority=(d_qname_iter)->priority;
r.auth = d_qname_iter->auth;
d_qname_iter++;
return true;
string nsec3hash;
uint32_t ttl;
uint16_t qtype;
- uint16_t priority;
- mutable bool auth;
+ mutable bool auth;
bool operator<(const Bind2DNSRecord& rhs) const
{
if(qname < rhs.qname)
static pthread_rwlock_t s_state_lock;
void parseZoneFile(BB2DomainInfo *bbd);
- void insertRecord(BB2DomainInfo& bbd, const string &qname, const QType &qtype, const string &content, int ttl=300, int prio=25, const std::string& hashed=string(), bool *auth=0);
+ void insertRecord(BB2DomainInfo& bbd, const string &qname, const QType &qtype, const string &content, int ttl, const std::string& hashed=string(), bool *auth=0);
void rediscover(string *status=0);
bool isMaster(const string &name, const string &ip);
{
QType qt;
vector<string> parts;
- string attrname, content, qstr;
+ string attrname, qstr;
try
while( m_value != m_attribute->second.end() )
{
- content = *m_value;
rr.qtype = qt;
rr.qname = *m_adomain;
- rr.priority = 0;
rr.ttl = m_ttl;
rr.last_modified = m_last_modified;
-
- if( qt.getCode() == QType::MX || qt.getCode() == QType::SRV ) // Priority, e.g. 10 smtp.example.com
- {
- char* endptr;
- string::size_type first = content.find_first_of( " " );
-
- if( first == string::npos )
- {
- L << Logger::Warning << m_myname << " Invalid " << attrname << " without priority for " << m_qname << ": " << content << endl;
- m_value++;
- continue;
- }
-
- rr.priority = (uint16_t) strtoul( (content.substr( 0, first )).c_str(), &endptr, 10 );
- if( *endptr != '\0' )
- {
- L << Logger::Warning << m_myname << " Invalid " << attrname << " without priority for " << m_qname << ": " << content << endl;
- m_value++;
- continue;
- }
-
- content = content.substr( first + 1, content.length() - first - 1 );
- }
-
- rr.content = content;
+ rr.content = *m_value;
m_value++;
- DLOG( L << Logger::Debug << m_myname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", priority: " << rr.priority << ", ttl: " << rr.ttl << ", content: " << rr.content << endl );
+ DLOG( L << Logger::Debug << m_myname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", ttl: " << rr.ttl << ", content: " << rr.content << endl );
return true;
}
rr.domain_id = domain_id;
rr.ttl = atoi( valparts[1].c_str() );
-
- if( rr.qtype.getCode() != QType::MX && rr.qtype.getCode() != QType::SRV )
- rr.content = valparts[2];
- else {
- // split out priority field
- string::size_type pos = valparts[2].find_first_of(" ", 0);
-
- rr.priority = atoi( valparts[2].substr(0, pos).c_str() );
- rr.content = valparts[2].substr(pos+1, valparts[2].length());
- }
+ rr.content = valparts[2];
return true;
}
}
}
- rr.priority = atol(rrow[2].c_str());
+ if (rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::SRV)
+ rr.content=rrow[2]+" "+rr.content;
rr.ttl = atol(rrow[3].c_str());
if (d_useminimalttl && rr.ttl < d_minimum)
rr.ttl = d_minimum;
bool OdbxBackend::get( DNSResourceRecord& rr )
{
const char* tmp;
-
+ string priority;
try
{
if( getRecord( READ ) )
{
+
rr.content = "";
- rr.priority = 0;
rr.domain_id = 0;
rr.last_modified = 0;
rr.ttl = m_default_ttl;
if( ( tmp = odbx_field_value( m_result, 4 ) ) != NULL )
{
- rr.priority = (uint16_t) strtoul( tmp, NULL, 10 );
+ priority = string( tmp, odbx_field_length( m_result, 4 ) );
}
if( ( tmp = odbx_field_value( m_result, 5 ) ) != NULL )
rr.content = string( tmp, odbx_field_length( m_result, 5 ) );
}
+ if (rr.qtype==QType::MX || rr.qtype==QType::SRV)
+ rr.content = priority + " " + rr.content;
+
return true;
}
}
}
string tmp = rr.qname;
+
+ int priority=0;
+ string content(rr.content);
+
+ if(rr.qtype == QType::MX || rr.qtype == QType::SRV) {
+ priority=atoi(content.c_str());
+
+ string::size_type pos = content.find_first_not_of("0123456789");
+ if(pos != string::npos)
+ boost::erase_head(content, pos);
+ trim_left(content);
+ }
+
int len = snprintf( m_buffer, sizeof( m_buffer ) - 1, getArg( "sql-insert-record" ).c_str(), rr.domain_id,
- escape( toLowerByRef( tmp ), WRITE ).c_str(), rr.qtype.getName().c_str(), rr.ttl, rr.priority,
- escape( rr.content, WRITE ).c_str() );
+ escape( toLowerByRef( tmp ), WRITE ).c_str(), rr.qtype.getName().c_str(), rr.ttl, priority,
+ escape( content, WRITE ).c_str() );
if( len < 0 )
{
OCIStmt *stmt;
uint32_t ttl;
- char content[4001];
stmt = prepare_query(masterSvcCtx, insertRecordQuerySQL, insertRecordQueryKey);
bind_str_failokay(stmt, ":nsname", myServerName, sizeof(myServerName));
bind_str(stmt, ":name", mQueryName, sizeof(mQueryName));
bind_str(stmt, ":type", mQueryType, sizeof(mQueryType));
bind_uint32(stmt, ":ttl", &ttl);
- bind_str(stmt, ":content", content, sizeof(content));
+ bind_str(stmt, ":content", mQueryContent, sizeof(mQueryContent));
mQueryZoneId = rr.domain_id;
string_to_cbuf(mQueryName, rr.qname, sizeof(mQueryName));
ttl = rr.ttl;
string_to_cbuf(mQueryType, rr.qtype.getName(), sizeof(mQueryType));
- if (rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::SRV) {
- snprintf(content, sizeof(content), "%d %s", rr.priority, rr.content.c_str());
- } else {
- string_to_cbuf(content, rr.content, sizeof(content));
- }
+ string_to_cbuf(mQueryContent, rr.content, sizeof(mQueryContent));
rc = OCIStmtExecute(masterSvcCtx, stmt, oraerr, 1, 0, NULL, NULL, OCI_DEFAULT);
throw PDNSException("Format error communicating with coprocess in data section of MX/SRV record");
}
- r.priority=atoi(parts[6+extraFields].c_str());
- r.content=parts[7+extraFields];
+ r.content=parts[6+extraFields]+" "+parts[7+extraFields];
}
break;
}
dr.d_class = 1;
dr.d_type = rr.qtype.getCode();
dr.d_clen = val.size()-pr.d_pos;
- DNSRecordContent *drc = DNSRecordContent::mastermake(dr, pr);
- string content = drc->getZoneRepresentation();
- // cerr<<"CONTENT: "<<content<<endl;
+ DNSRecordContent *drc = DNSRecordContent::mastermake(dr, pr);
+ rr.content = drc->getZoneRepresentation();
+ // cerr<<"CONTENT: "<<rr.content<<endl;
delete drc;
- if(rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::SRV) {
- vector<string>parts;
- stringtok(parts,content," ");
- rr.priority=atoi(parts[0].c_str());
- rr.content=content.substr(parts[0].size()+1);
- } else {
- rr.content = content;
- }
}
catch (...) {
if (d_ignorebogus) {
// L << "GSQLBackend get() was called for "<<qtype.getName() << " record: ";
SSql::row_t row;
if(d_db->getRow(row)) {
- r.content=row[0];
if (row[1].empty())
r.ttl = ::arg().asNum( "default-ttl" );
- else
+ else
r.ttl=atol(row[1].c_str());
- r.priority=atol(row[2].c_str());
if(!d_qname.empty())
r.qname=d_qname;
else
r.qname=row[6];
r.qtype=row[3];
+
+ if (r.qtype==QType::MX || r.qtype==QType::SRV)
+ r.content=row[2]+" "+row[0];
+ else
+ r.content=row[0];
+
r.last_modified=0;
-
+
if(d_dnssecQueries)
r.auth = !row[7].empty() && row[7][0]=='1';
else
bool GSQLBackend::feedRecord(const DNSResourceRecord &r, string *ordername)
{
+ int prio=0;
+ string content(r.content);
+
+ if(r.qtype == QType::MX || r.qtype == QType::SRV) {
+ prio=atoi(content.c_str());
+
+ string::size_type pos = content.find_first_not_of("0123456789");
+ if(pos != string::npos)
+ boost::erase_head(content, pos);
+ trim_left(content);
+ }
+
string query;
if(d_dnssecQueries && ordername)
query = (GSQLformat(d_InsertRecordOrderQuery)
- % sqlEscape(r.content)
+ % sqlEscape(content)
% r.ttl
- % r.priority
+ % prio
% sqlEscape(r.qtype.getName())
% r.domain_id
% (int)r.disabled
).str();
else
query = (GSQLformat(d_InsertRecordQuery)
- % sqlEscape(r.content)
+ % sqlEscape(content)
% r.ttl
- % r.priority
+ % prio
% sqlEscape(r.qtype.getName())
% r.domain_id
% (int)r.disabled
class DNSResourceRecord
{
public:
- DNSResourceRecord() : qclass(1), priority(0), signttl(0), last_modified(0), d_place(ANSWER), auth(1), disabled(0), scopeMask(0) {};
+ DNSResourceRecord() : qclass(1), signttl(0), last_modified(0), d_place(ANSWER), auth(1), disabled(0), scopeMask(0) {};
DNSResourceRecord(const struct DNSRecord&);
~DNSResourceRecord(){};
string qname; //!< the name of this record, for example: www.powerdns.com
string wildcardname;
string content; //!< what this record points to. Example: 10.1.2.3
- uint16_t priority; //!< For qtypes that support a priority or preference (MX, SRV)
uint32_t ttl; //!< Time To Live of this record
uint32_t signttl; //!< If non-zero, use this TTL as original TTL in the RRSIG
int domain_id; //!< If a backend implements this, the domain_id of the zone this record is in
ar & qname;
ar & wildcardname;
ar & content;
- ar & priority;
ar & ttl;
ar & domain_id;
ar & last_modified;
if(d_compress)
for(vector<DNSResourceRecord>::const_iterator i=d_rrs.begin();i!=d_rrs.end();++i)
if(rr.qname==i->qname && rr.qtype==i->qtype && rr.content==i->content) {
- if(rr.qtype.getCode()!=QType::MX && rr.qtype.getCode()!=QType::SRV)
- return;
- if(rr.priority==i->priority)
return;
}
uint8_t maxScopeMask=0;
for(pos=d_rrs.begin(); pos < d_rrs.end(); ++pos) {
maxScopeMask = max(maxScopeMask, pos->scopeMask);
- // this needs to deal with the 'prio' mismatch:
- if(pos->qtype.getCode()==QType::MX || pos->qtype.getCode() == QType::SRV) {
- pos->content = lexical_cast<string>(pos->priority) + " " + pos->content;
- }
if(!pos->content.empty() && pos->qtype.getCode()==QType::TXT && pos->content[0]!='"') {
pos->content="\""+pos->content+"\"";
rr.qtype = j->first.d_type;
rr.ttl=j->first.d_ttl;
rr.d_place= (DNSResourceRecord::Place)j->first.d_place;
- shared_ptr<MXRecordContent> mx=boost::dynamic_pointer_cast<MXRecordContent>(j->first.d_content);
- shared_ptr<SRVRecordContent> srv=boost::dynamic_pointer_cast<SRVRecordContent>(j->first.d_content);
- if(mx) {
- rr.content=mx->d_mxname;
- rr.priority=mx->d_preference;
- }
- else if(srv) {
- rr.content = lexical_cast<string>(srv->d_weight)+" "+lexical_cast<string>(srv->d_port)+" "+srv->d_target;
- rr.priority=srv->d_preference;
- }
- else {
- rr.content=j->first.d_content->getZoneRepresentation();
- }
+ rr.content=j->first.d_content->getZoneRepresentation();
i->second.complete->addRecord(rr);
}
}
void DNSResourceRecord::setContent(const string &cont) {
content = cont;
- if(!content.empty() && (qtype==QType::MX || qtype==QType::NS || qtype==QType::CNAME))
- boost::erase_tail(content, 1);
-
- if(qtype.getCode() == QType::MX) {
- vector<string> parts;
- stringtok(parts, content);
- priority = atoi(parts[0].c_str());
- if(parts.size() > 1)
- content=parts[1];
- else
- content=".";
- } else if(qtype.getCode() == QType::SRV) {
- priority = atoi(content.c_str());
- vector<pair<string::size_type, string::size_type> > fields;
- vstringtok(fields, content, " ");
- if(fields.size()==4) {
- content=string(content.c_str() + fields[1].first, fields[3].second - fields[1].first);
- content=stripDot(content);
- }
+ switch(qtype.getCode()) {
+ case QType::SRV:
+ case QType::MX:
+ if (content.size() >= 2 && *(content.rbegin()+1) == ' ')
+ return;
+ case QType::CNAME:
+ case QType::NS:
+ if(!content.empty())
+ boost::erase_tail(content, 1);
}
}
switch(qtype.getCode()) {
case QType::SRV:
case QType::MX:
- ret<<priority;
- ret<<" "<<content;
- if (*(content.rbegin()) != '.') ret<<".";
- break;
case QType::CNAME:
case QType::NS:
- ret<<content;
- if (*(content.rbegin()) != '.') ret<<".";
- break;
+ if (*(content.rbegin()) != '.')
+ ret<<content<<".";
+ break;
default:
ret<<content;
break;
string rlabel=toLower(rhs.qname);
return
- tie(llabel, qtype, lcontent, ttl, priority) ==
- tie(rlabel, rhs.qtype, rcontent, rhs.ttl, rhs.priority);
+ tie(llabel, qtype, lcontent, ttl) ==
+ tie(rlabel, rhs.qtype, rcontent, rhs.ttl);
}
qtype = p.d_type;
ttl = p.d_ttl;
- priority=0;
setContent(p.d_content->getZoneRepresentation());
}
signPlace = (DNSPacketWriter::Place) pos->d_place;
if(pos->auth || pos->qtype.getCode() == QType::DS) {
string content = pos->content;
- if(pos->qtype.getCode()==QType::MX || pos->qtype.getCode() == QType::SRV) {
- content = lexical_cast<string>(pos->priority) + " " + pos->content;
- }
if(!pos->content.empty() && pos->qtype.getCode()==QType::TXT && pos->content[0]!='"') {
content="\""+pos->content+"\"";
}
lua_pushstring(d_lua, in.qname.c_str() );
lua_pushnumber(d_lua, in.qtype.getCode() );
lua_pushnumber(d_lua, in.ttl );
- lua_pushnumber(d_lua, in.priority );
lua_pushstring(d_lua, in.content.c_str() );
if(lua_pcall(d_lua, 7, 2, 0)) { // error
}
string content = stripDot(i->content);
+ if(i->qtype == QType::MX || i->qtype == QType::SRV) {
+ string::size_type pos = content.find_first_not_of("0123456789");
+ if(pos != string::npos)
+ boost::erase_head(content, pos);
+ trim_left(content);
+ }
QType qtypes[2];
qtypes[0]="A"; qtypes[1]="AAAA";
rr.content=o.str();
}
- if(rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::SRV)
- rr.content = lexical_cast<string>(rr.priority)+" "+rr.content;
-
if(rr.qtype.getCode() == QType::TXT && !rr.content.empty() && rr.content[0]!='"')
rr.content = "\""+rr.content+"\"";
rr.auth=1;
rr.qclass = QClass::IN;
rr.d_place=DNSResourceRecord::ANSWER;
- rr.priority=0;
UeberBackend db("key-only");
rr.qtype = i->first.d_type;
rr.ttl = i->first.d_ttl;
rr.content = i->first.d_content->getZoneRepresentation();
- rr.priority = 0;
-
- uint16_t qtype=rr.qtype.getCode();
-
- if(!rr.content.empty() && (qtype==QType::MX || qtype==QType::NS || qtype==QType::CNAME))
- boost::erase_tail(rr.content, 1);
-
- if(rr.qtype.getCode() == QType::MX) {
- vector<string> parts;
- stringtok(parts, rr.content);
- rr.priority = atoi(parts[0].c_str());
- if(parts.size() > 1)
- rr.content=parts[1];
- else
- rr.content=".";
- } else if(rr.qtype.getCode() == QType::SRV) {
- rr.priority = atoi(rr.content.c_str());
- vector<pair<string::size_type, string::size_type> > fields;
- vstringtok(fields, rr.content, " ");
- if(fields.size()==4) {
- if(fields[3].second - fields[3].first > 1) // strip dot, unless root
- fields[3].second--;
- rr.content=string(rr.content.c_str() + fields[1].first, fields[3].second - fields[1].first);
- }
+ switch(rr.qtype.getCode()) {
+ case QType::SRV:
+ case QType::MX:
+ if (rr.content.size() >= 2 && *(rr.content.rbegin()+1) == ' ')
+ break;
+ case QType::CNAME:
+ case QType::NS:
+ if(!rr.content.empty())
+ boost::erase_tail(rr.content, 1);
}
result->push_back(rr);
}
}
namespace {
-bool dedupLessThan(const DNSResourceRecord& a, const DNSResourceRecord &b)
+bool
+dedupLessThan(const DNSResourceRecord& a, const DNSResourceRecord &b)
{
- if(tie(a.content, a.ttl) < tie(b.content, b.ttl))
- return true;
- if(a.qtype.getCode() == QType::MX || a.qtype.getCode() == QType::SRV)
- return a.priority < b.priority;
- return false;
+ return (tie(a.content, a.ttl) < tie(b.content, b.ttl));
}
bool dedupEqual(const DNSResourceRecord& a, const DNSResourceRecord &b)
{
- if(tie(a.content, a.ttl) != tie(b.content, b.ttl))
- return false;
- if(a.qtype.getCode() == QType::MX || a.qtype.getCode() == QType::SRV)
- return a.priority == b.priority;
- return true;
+ return(tie(a.content, a.ttl) == tie(b.content, b.ttl));
}
}
Value jtype(rr.qtype.getName().c_str(), doc.GetAllocator()); // copy
object.AddMember("type", jtype, doc.GetAllocator());
object.AddMember("ttl", rr.ttl, doc.GetAllocator());
- object.AddMember("priority", rr.priority, doc.GetAllocator());
object.AddMember("disabled", rr.disabled, doc.GetAllocator());
Value jcontent(rr.content.c_str(), doc.GetAllocator()); // copy
object.AddMember("content", jcontent, doc.GetAllocator());
rr.content = stringFromJson(record, "content");
rr.auth = 1;
rr.ttl = intFromJson(record, "ttl");
- rr.priority = intFromJson(record, "priority");
rr.disabled = boolFromJson(record, "disabled");
- string temp_content = rr.content;
- if (rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::SRV)
- temp_content = lexical_cast<string>(rr.priority)+" "+rr.content;
-
try {
- shared_ptr<DNSRecordContent> drc(DNSRecordContent::mastermake(rr.qtype.getCode(), 1, temp_content));
+ shared_ptr<DNSRecordContent> drc(DNSRecordContent::mastermake(rr.qtype.getCode(), 1, rr.content));
string tmp = drc->serialize(rr.qname);
}
catch(std::exception& e)
if(rr.qtype.getCode() == QType::SOA)
seenSOA=true;
- rr.priority = 0;
-
- if (rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::SRV) {
- int prio;
- prio=atoi(rr.content.c_str());
-
- string::size_type pos = rr.content.find_first_not_of("0123456789");
- if(pos != string::npos)
- boost::erase_head(rr.content, pos);
- trim_left(rr.content);
- rr.priority = prio;
- }
-
-
rr.qname = stripDot(rr.qname);
new_records.push_back(rr);
}
rr.qname = zonename;
rr.auth = 1;
rr.ttl = ::arg().asNum("default-ttl");
- rr.priority = 0;
if (!have_soa && zonekind != DomainInfo::Slave) {
// synthesize a SOA record so the zone "really" exists
break;
case QType::MX:
case QType::SRV:
- content = lexical_cast<string>(rr.priority) + "\t" + makeDotted(content);
- break;
case QType::CNAME:
case QType::NS:
case QType::AFSDB:
ptr->qtype = "PTR";
ptr->ttl = rr.ttl;
ptr->disabled = rr.disabled;
- ptr->priority = 0;
ptr->content = rr.qname;
}
rr.domain_id = di.id;
rr.auth = 1;
rr.ttl = sd.ttl;
- rr.priority = 0;
editSOARecord(rr, soa_edit_api_kind);
if (!di.backend->replaceRRSet(di.id, rr.qname, rr.qtype, vector<DNSResourceRecord>(1, rr))) {
}
-static string emitRecord(const string& zoneName, const string &qname, const string &qtype, const string &ocontent, int ttl, int prio)
+static string emitRecord(const string& zoneName, const string &qname, const string &qtype, const string &ocontent, int ttl)
{
+ int prio=0;
string retval;
g_numRecords++;
string content(ocontent);
ZoneParserTNG zpt(i->filename, i->name, BP.getDirectory());
DNSResourceRecord rr;
while(zpt.get(rr))
- lines.push_back(emitRecord(i->name, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority));
+ lines.push_back(emitRecord(i->name, rr.qname, rr.qtype.getName(), rr.content, rr.ttl));
cout << "{\"name\":\"" << i->name << "\",\"records\": ";
emitJson(lines);
cout << "},";
string zname;
cout << "{\"name\":\"" << ::arg()["zone-name"] << "\",\"records\":";
while(zpt.get(rr))
- lines.push_back(emitRecord(::arg()["zone-name"], rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority));
+ lines.push_back(emitRecord(::arg()["zone-name"], rr.qname, rr.qtype.getName(), rr.content, rr.ttl));
emitJson(lines);
cout << "}\n";
num_domainsdone=1;
string g_zonename;
map<string,bool> g_objects;
-static void callback_simple( unsigned int domain_id, const string &domain, const string &qtype, const string &content, int ttl, int prio )
+static void callback_simple( unsigned int domain_id, const string &domain, const string &qtype, const string &content, int ttl )
{
string host;
string::size_type pos;
cout << "add: " << qtype << "Record" << endl;
}
- cout << qtype << "Record: ";
- if( prio != 0 ) { cout << prio << " "; }
- cout << stripDot( content ) << endl << endl;
+ cout << qtype << "Record: " << stripDot( content ) << endl << endl;
}
-static void callback_tree( unsigned int domain_id, const string &domain, const string &qtype, const string &content, int ttl, int prio )
+static void callback_tree( unsigned int domain_id, const string &domain, const string &qtype, const string &content, int ttl )
{
unsigned int i;
string dn, net;
cout << "add: " << qtype << "Record" << endl;
}
- cout << qtype << "Record: ";
- if( prio != 0 ) { cout << prio << " "; }
- cout << stripDot( content ) << endl << endl;
+ cout << qtype << "Record: " << stripDot( content ) << endl << endl;
}
g_basedn = args["basedn"];
g_dnsttl = args.mustDo( "dnsttl" );
- typedef boost::function<void(unsigned int, const string &, const string &, const string &, int, int)> callback_t;
+ typedef boost::function<void(unsigned int, const string &, const string &, const string &, int)> callback_t;
callback_t callback = callback_simple;
if( args["layout"] == "tree" )
{
ZoneParserTNG zpt(i->filename, i->name, BP.getDirectory());
DNSResourceRecord rr;
while(zpt.get(rr))
- callback(0, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority);
+ callback(0, rr.qname, rr.qtype.getName(), rr.content, rr.ttl);
}
}
catch( PDNSException &ae )
ZoneParserTNG zpt(args["zone-file"], args["zone-name"]);
DNSResourceRecord rr;
while(zpt.get(rr))
- callback(0, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority);
+ callback(0, rr.qname, rr.qtype.getName(), rr.content, rr.ttl);
}
}
catch( PDNSException &ae )
}
bool g_doJSONComments;
-static void emitRecord(const string& zoneName, const string &qname, const string &qtype, const string &ocontent, int ttl, int prio, const string& comment="")
+static void emitRecord(const string& zoneName, const string &qname, const string &qtype, const string &ocontent, int ttl, const string& comment="")
{
+ int prio=0;
int disabled=0;
string recordcomment;
continue;
if(rr.qtype.getCode() == QType::SOA)
seenSOA=true;
- emitRecord(i->name, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority, comment);
+ emitRecord(i->name, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, comment);
}
num_domainsdone++;
}
if(rr.qtype.getCode() == QType::SOA)
seenSOA=true;
- emitRecord(zonename, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, rr.priority, comment);
+ emitRecord(zonename, rr.qname, rr.qtype.getName(), rr.content, rr.ttl, comment);
}
num_domainsdone=1;
}