git ssb

15+

ansuz / dnssb



Commit 7c227cc61b64d52dcbdc703c54d0a77667c1cef2

Fix name detection

cel committed on 4/14/2017, 10:22:37 AM
Parent: be4fb56732f000c07958a467fe9d4570b31a593e

Files changed

lib/query.jschanged
lib/query.jsView
@@ -294,8 +294,12 @@
294294 if (!--waiting) cb(null, result);
295295 }
296296 }
297297
298 +function removeTrailingDot(domain) {
299 + return String(domain).replace(/\.$/, '')
300 +}
301 +
298302 Query.querySingle = function (sbot, question, cb) {
299303 // look up records that match a question, including wildcard records
300304 // and zone authority records
301305 var qName = question.name.toLowerCase();
@@ -320,9 +324,9 @@
320324 && zoneSerials.getSerial(qName) < question.serial) {
321325 return false
322326 }
323327 var nameMatches = isTransfer ? qName in recordDomains :
324- record.name in wildcardDomains;
328 + removeTrailingDot(record.name) in wildcardDomains;
325329 if (nameMatches) {
326330 result.domainExists = true;
327331 }
328332 if (!isTransfer) {
@@ -346,9 +350,9 @@
346350 if (record.type === 'NS' || record.type === 'SOA') {
347351 result.authoritative = true;
348352 if (question.class === record.class
349353 && question.type === record.type
350- && record.name in wildcardDomains) {
354 + && removeTrailingDot(record.name) in wildcardDomains) {
351355 answers.addRecord(record);
352356 } else {
353357 authorities.addRecord(record);
354358 if (isTransfer) {
@@ -356,9 +360,9 @@
356360 }
357361 }
358362 } else if (!isTransfer
359363 && (record.type === 'A' || record.type === 'AAAA')
360- && (!(record.name in wildcardDomains)
364 + && (!(removeTrailingDot(record.name) in wildcardDomains)
361365 || (question.type !== record.type && question.type !== '*')
362366 || (question.class !== record.class && question.class !== '*'))
363367 ) {
364368 maybeGlue.addRecord(record);

Built with git-ssb-web