);
#ifdef HAVE_LUA_RECORDS
-string LUARecordContent::getCode()
+string LUARecordContent::getCode() const
{
// in d_code, series of "part1" "part2"
vector<string> parts;
{
public:
includeboilerplate(LUA)
- string getCode();
+ string getCode() const;
uint16_t d_type;
string d_code;
};
for(const auto& content: contents) {
if(qtype==QType::TXT)
- ret.push_back(std::shared_ptr<DNSRecordContent>(DNSRecordContent::mastermake(qtype, 1, '"'+content+'"' )));
+ ret.push_back(DNSRecordContent::mastermake(qtype, QClass::IN, '"'+content+'"' ));
else
- ret.push_back(std::shared_ptr<DNSRecordContent>(DNSRecordContent::mastermake(qtype, 1, content )));
+ ret.push_back(DNSRecordContent::mastermake(qtype, QClass::IN, content ));
}
} catch(std::exception &e) {
g_log<<Logger::Error<<"Lua record reported: "<<e.what()<<endl;
DLOG(g_log<<"Have a wildcard LUA match"<<endl);
auto rec=getRR<LUARecordContent>(rr.dr);
- if(rec->d_type == QType::CNAME || rec->d_type == p->qtype.getCode()) {
+ if (!rec) {
+ continue;
+ }
+ if(rec->d_type == QType::CNAME || rec->d_type == p->qtype.getCode() || (p->qtype.getCode() == QType::ANY && rec->d_type != QType::RRSIG)) {
// noCache=true;
DLOG(g_log<<"Executing Lua: '"<<rec->getCode()<<"'"<<endl);
try {
if(!doLua)
continue;
auto rec=getRR<LUARecordContent>(rr.dr);
- if(rec->d_type == QType::CNAME || rec->d_type == p->qtype.getCode()) {
+ if (!rec) {
+ continue;
+ }
+ if(rec->d_type == QType::CNAME || rec->d_type == p->qtype.getCode() || (p->qtype.getCode() == QType::ANY && rec->d_type != QType::RRSIG)) {
noCache=true;
try {
auto recvec=luaSynth(rec->getCode(), target, sd.qname, sd.domain_id, *p, rec->d_type);