From bacbde31f3e4e2de48bce6848f6d7c610fe6a7be Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Sun, 14 Feb 2021 16:25:48 +0300 Subject: LookupServer: Move case randomization into DNSName * DNSName knows how to randomize itself * DNSPacket no longer constructs DNSQuestion instances, it receives an already built DNSQuestion and just adds it to the list * LookupServer::lookup() explicitly calls randomize_case() if it needs to randomize the case. --- Userland/Services/LookupServer/LookupServer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Userland/Services/LookupServer/LookupServer.cpp') diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp index c050268ce4..826094a0eb 100644 --- a/Userland/Services/LookupServer/LookupServer.cpp +++ b/Userland/Services/LookupServer/LookupServer.cpp @@ -172,7 +172,10 @@ Vector LookupServer::lookup(const DNSName& name, const String& nameserve DNSPacket request; request.set_is_query(); request.set_id(arc4random_uniform(UINT16_MAX)); - request.add_question(name.as_string(), record_type, should_randomize_case); + DNSName name_in_question = name; + if (should_randomize_case == ShouldRandomizeCase::Yes) + name_in_question.randomize_case(); + request.add_question({ name_in_question, record_type, C_IN }); auto buffer = request.to_byte_buffer(); -- cgit v1.2.3