Commit 7c227cc61b64d52dcbdc703c54d0a77667c1cef2
Fix name detection
cel committed on 4/14/2017, 10:22:37 AMParent: be4fb56732f000c07958a467fe9d4570b31a593e
Files changed
lib/query.js | changed |
lib/query.js | ||
---|---|---|
@@ -294,8 +294,12 @@ | ||
294 | 294 … | if (!--waiting) cb(null, result); |
295 | 295 … | } |
296 | 296 … | } |
297 | 297 … | |
298 … | +function removeTrailingDot(domain) { | |
299 … | + return String(domain).replace(/\.$/, '') | |
300 … | +} | |
301 … | + | |
298 | 302 … | Query.querySingle = function (sbot, question, cb) { |
299 | 303 … | // look up records that match a question, including wildcard records |
300 | 304 … | // and zone authority records |
301 | 305 … | var qName = question.name.toLowerCase(); |
@@ -320,9 +324,9 @@ | ||
320 | 324 … | && zoneSerials.getSerial(qName) < question.serial) { |
321 | 325 … | return false |
322 | 326 … | } |
323 | 327 … | var nameMatches = isTransfer ? qName in recordDomains : |
324 | - record.name in wildcardDomains; | |
328 … | + removeTrailingDot(record.name) in wildcardDomains; | |
325 | 329 … | if (nameMatches) { |
326 | 330 … | result.domainExists = true; |
327 | 331 … | } |
328 | 332 … | if (!isTransfer) { |
@@ -346,9 +350,9 @@ | ||
346 | 350 … | if (record.type === 'NS' || record.type === 'SOA') { |
347 | 351 … | result.authoritative = true; |
348 | 352 … | if (question.class === record.class |
349 | 353 … | && question.type === record.type |
350 | - && record.name in wildcardDomains) { | |
354 … | + && removeTrailingDot(record.name) in wildcardDomains) { | |
351 | 355 … | answers.addRecord(record); |
352 | 356 … | } else { |
353 | 357 … | authorities.addRecord(record); |
354 | 358 … | if (isTransfer) { |
@@ -356,9 +360,9 @@ | ||
356 | 360 … | } |
357 | 361 … | } |
358 | 362 … | } else if (!isTransfer |
359 | 363 … | && (record.type === 'A' || record.type === 'AAAA') |
360 | - && (!(record.name in wildcardDomains) | |
364 … | + && (!(removeTrailingDot(record.name) in wildcardDomains) | |
361 | 365 … | || (question.type !== record.type && question.type !== '*') |
362 | 366 … | || (question.class !== record.class && question.class !== '*')) |
363 | 367 … | ) { |
364 | 368 … | maybeGlue.addRecord(record); |
Built with git-ssb-web