Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

Commit

Permalink
Respond with NOTIMP for DNS queries that aren't supported
Browse files Browse the repository at this point in the history
  • Loading branch information
causal-agent committed Feb 2, 2014
1 parent ef2686a commit 840715a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pult-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ var dnsServer = dns.createServer();
dnsServer.on('request', function dnsRequest(req, res) {
var name = req.question[0].name;
var type = dns.consts.QTYPE_TO_NAME[req.question[0].type];
if (getPort(name)) {
if (type == 'A' || type == 'ANY')
res.answer.push(dns.A({
name: name,
address: listenHost,
ttl: 600
}));
if (getPort(name) && (type == 'A' || type == 'ANY')) {
res.answer.push(dns.A({
name: name,
address: listenHost,
ttl: 600
}));
} else {
res.header.rcode = dns.consts.NAME_TO_RCODE.NOTIMP;
}
res.send();
});
Expand Down

0 comments on commit 840715a

Please sign in to comment.