boilerplate_conv(MR, QType::MR, conv.xfrName(d_alias, true));
boilerplate_conv(MINFO, QType::MINFO, conv.xfrName(d_rmailbx, true); conv.xfrName(d_emailbx, true));
boilerplate_conv(TXT, QType::TXT, conv.xfrText(d_text, true));
+boilerplate_conv(LUA, QType::LUA, conv.xfrText(d_code, true));
boilerplate_conv(ENT, 0, );
boilerplate_conv(SPF, 99, conv.xfrText(d_text, true));
boilerplate_conv(HINFO, QType::HINFO, conv.xfrText(d_cpu); conv.xfrText(d_host));
PTRRecordContent::report();
DNSRecordContent::regist(QClass::CHAOS, QType::TXT, &TXTRecordContent::make, &TXTRecordContent::make, "TXT");
TXTRecordContent::report();
+ LUARecordContent::report();
DNSRecordContent::regist(QClass::IN, QType::ANY, 0, 0, "ANY");
DNSRecordContent::regist(QClass::IN, QType::AXFR, 0, 0, "AXFR");
DNSRecordContent::regist(QClass::IN, QType::IXFR, 0, 0, "IXFR");
AuthLua4::~AuthLua4() { }
+
+
+std::vector<shared_ptr<DNSRecordContent>> luaSynth(const std::string& code, uint16_t qtype)
+{
+ std::vector<shared_ptr<DNSRecordContent>> ret;
+ cout<<"Code: "<<code<<endl;
+ string strip=code.c_str()+1;
+ strip.resize(strip.size()-1);
+
+ LuaContext lua;
+ ret.push_back(std::shared_ptr<DNSRecordContent>(DNSRecordContent::mastermake(qtype, 1, lua.executeCode<string>("return "+strip))));
+
+ return ret;
+}
+
#endif
weDone = weRedirected = weHaveUnauth = false;
while(B.get(rr)) {
+ if(rr.dr.d_type == QType::LUA) {
+ cerr<<"We got LUA: "<<endl;
+ auto recvec=luaSynth(getRR<LUARecordContent>(rr.dr)->d_code, p->qtype.getCode());
+ if(!recvec.empty()) {
+ cerr<<"We got answers from Lua"<<endl;
+ for(const auto& r : recvec) {
+ rr.dr.d_type = p->qtype.getCode();
+ rr.dr.d_content = r;
+ rrset.push_back(rr);
+ }
+ weDone = 1;
+ }
+ }
//cerr<<"got content: ["<<rr.content<<"]"<<endl;
if (p->qtype.getCode() == QType::ANY && !p->d_dnssecOk && (rr.dr.d_type == QType:: DNSKEY || rr.dr.d_type == QType::NSEC3PARAM))
continue; // Don't send dnssec info to non validating resolvers.