return [
record("SOA","example.com", "sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600"),
record("NS","example.com","sns.dns.icann.org"),
- record_prio("MX","example.com","test.example.com",10)
+ record("MX","example.com","10 test.example.com")
]
elsif args["qname"] == "test.example.com" and args["qtype"].downcase == "any"
return [
return [
record("SOA","example.com", "sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600"),
record("NS","example.com","sns.dns.icann.org"),
- record_prio("MX","example.com","test.example.com",10),
+ record("MX","example.com","10 test.example.com"),
record("A","test.example.com","127.0.0.1")
]
end
## Some helpers after this
- def record_prio_ttl(qtype,qname,content,prio,ttl)
- {:qtype => qtype, :qname => qname, :content => content, :priority => prio, :ttl => ttl, :auth => 1}
- end
-
- def record_prio(qtype,qname,content,prio)
- record_prio_ttl(qtype,qname,content,prio,@default_ttl)
+ def record_ttl(qtype,qname,content,ttl)
+ {:qtype => qtype, :qname => qname, :content => content, :ttl => ttl, :auth => 1}
end
def record(qtype,qname,content)
- record_prio_ttl(qtype,qname,content,0,@default_ttl)
+ record_ttl(qtype,qname,content,@default_ttl,)
end
def log(message)
require 'json'
require 'sqlite3'
-def rr(qname, qtype, content, ttl, priority = 0, auth = 1, domain_id = -1)
- {:qname => qname, :qtype => qtype, :content => content, :ttl => ttl.to_i, :priority => priority.to_i, :auth => auth.to_i, :domain_id => domain_id.to_i}
+def rr(qname, qtype, content, ttl, auth = 1, domain_id = -1)
+ {:qname => qname, :qtype => qtype, :content => content, :ttl => ttl.to_i, :auth => auth.to_i, :domain_id => domain_id.to_i}
end
class Handler
end
end
db.execute(sql, sargs) do |row|
- ret << rr(row[1], row[2], row[3], row[4], row[5], row[6], row[0])
+ if (row[2] == "MX" || row[2] == "SRV")
+ ret << rr(row[1], row[2], row[5]+" "+row[3], row[4], row[6], row[0])
+ else
+ ret << rr(row[1], row[2], row[3], row[4], row[6], row[0])
+ end
end
rescue Exception => e
e.backtrace
d_id = db.get_first_value("SELECT id FROM domains WHERE name = ?", target)
return false if d_id.nil?
db.execute("SELECT domain_id,name,type,content,ttl,prio,auth FROM records WHERE domain_id = ?", d_id) do |row|
- ret << rr(row[1], row[2], row[3], row[4], row[5], row[6], row[0])
+ if (row[2] == "MX" || row[2] == "SRV")
+ ret << rr(row[1], row[2], row[5]+" "+row[3], row[4], row[6], row[0])
+ else
+ ret << rr(row[1], row[2], row[3], row[4], row[6], row[0])
+ end
end
rescue Exception => e
e.backtrace
str.tr("ybndrfg8ejkmcpqxot1uwisza345h769", "0123456789abcdefghijklmnopqrstuv").to_i(32)
end
-def rr(qname, qtype, content, ttl, priority = 0, auth = 1)
- {:qname => qname, :qtype => qtype, :content => content, :ttl => ttl, :priority => priority, :auth => auth}
+def rr(qname, qtype, content, ttl, auth = 1)
+ {:qname => qname, :qtype => qtype, :content => content, :ttl => ttl, :auth => auth}
end
def send_result(*params)
str.tr("ybndrfg8ejkmcpqxot1uwisza345h769", "0123456789abcdefghijklmnopqrstuv").to_i(32)
end
-def rr(qname, qtype, content, ttl, priority = 0, auth = 1)
- {:qname => qname, :qtype => qtype, :content => content, :ttl => ttl, :priority => priority, :auth => auth}
+def rr(qname, qtype, content, ttl, auth = 1)
+ {:qname => qname, :qtype => qtype, :content => content, :ttl => ttl, :auth => auth}
end
def send_result(*params)
value = -1;
rr.ttl = getInt(JSON_GET((*d_result)["result"][d_index], "ttl",value));
rr.domain_id = getInt(JSON_GET((*d_result)["result"][d_index],"domain_id",value));
- rr.priority = getInt(JSON_GET((*d_result)["result"][d_index],"priority",value));
value = 1;
if (d_dnssec)
rr.auth = getInt(JSON_GET((*d_result)["result"][d_index],"auth", value));
JSON_ADD_MEMBER(rr, "qclass", QClass::IN, query.GetAllocator());
JSON_ADD_MEMBER(rr, "content", nsset[i].content.c_str(), query.GetAllocator());
JSON_ADD_MEMBER(rr, "ttl", nsset[i].ttl, query.GetAllocator());
- JSON_ADD_MEMBER(rr, "priority", nsset[i].priority, query.GetAllocator());
JSON_ADD_MEMBER(rr, "auth", nsset[i].auth, query.GetAllocator());
rrset.PushBack(rr, query.GetAllocator());
}
JSON_ADD_MEMBER(rr, "qclass", QClass::IN, query.GetAllocator());
JSON_ADD_MEMBER(rr, "content", rrset[i].content.c_str(), query.GetAllocator());
JSON_ADD_MEMBER(rr, "ttl", rrset[i].ttl, query.GetAllocator());
- JSON_ADD_MEMBER(rr, "priority", rrset[i].priority, query.GetAllocator());
JSON_ADD_MEMBER(rr, "auth", rrset[i].auth, query.GetAllocator());
rj_rrset.PushBack(rr, query.GetAllocator());
}
JSON_ADD_MEMBER(rj_rr, "qclass", QClass::IN, query.GetAllocator());
JSON_ADD_MEMBER(rj_rr, "content", rr.content.c_str(), query.GetAllocator());
JSON_ADD_MEMBER(rj_rr, "ttl", rr.ttl, query.GetAllocator());
- JSON_ADD_MEMBER(rj_rr, "priority", rr.priority, query.GetAllocator());
JSON_ADD_MEMBER(rj_rr, "auth", rr.auth, query.GetAllocator());
parameters.AddMember("rr", rj_rr, query.GetAllocator());
def initialize
end
- def rr(qname, qtype, content, ttl, priority = 0, auth = 1, domain_id = -1)
- {:qname => qname, :qtype => qtype, :content => content, :ttl => ttl.to_i, :priority => priority.to_i, :auth => auth.to_i, :domain_id => domain_id.to_i}
+ def rr(qname, qtype, content, ttl, auth = 1, domain_id = -1)
+ {:qname => qname, :qtype => qtype, :content => content, :ttl => ttl.to_i, :auth => auth.to_i, :domain_id => domain_id.to_i}
end
def do_initialize(*args)