Make queries case insensitivie

This commit is contained in:
Martin 2022-02-06 20:12:40 +01:00
parent 389f05f316
commit f06f51b247
Signed by: mawalu
GPG Key ID: BF556F989760A7C8
3 changed files with 4 additions and 4 deletions

View File

@ -46,7 +46,7 @@ proc present(req: Request, auth: Auth, base: string): Future[void] {.async.} =
addRecord(
records,
(name: name, dtype: DnsType.TXT),
(name: name.toLowerAscii(), dtype: DnsType.TXT),
record.value
)
@ -54,7 +54,7 @@ proc present(req: Request, auth: Auth, base: string): Future[void] {.async.} =
proc cleanup(req: Request, auth: Auth, base: string): Future[void] {.async.} =
let record = to(parseJson(req.body), NewRecordReq)
let name = trimName(record.fqdn) & "." & auth.name & "." & base
let name = trimName(record.fqdn.toLowerAscii()) & "." & auth.name & "." & base
echo &"Deleting TXT record for {name} with value {record.value}"

View File

@ -14,7 +14,7 @@ proc handleDnsRequest(records: RecordsTable, data: string): Option[string] =
let response = mkResponse(
msg.header.id,
question,
records.getOrDefault((name: question.qname, dtype: question.qtype), @[])
records.getOrDefault((name: question.qname.toLowerAscii(), dtype: question.qtype), @[])
)
echo response

View File

@ -1,4 +1,4 @@
import tables, strtabs, sequtils, nativesockets
import tables, strtabs, sequtils, nativesockets, strutils
import ../lib/dns
type