diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2021-02-14 16:25:48 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-15 09:14:42 +0100 |
commit | bacbde31f3e4e2de48bce6848f6d7c610fe6a7be (patch) | |
tree | dfde9c3b7d07b4a328b66023e73ce89ae38e0a88 /Userland/Services/LookupServer/LookupServer.cpp | |
parent | 89f718c4c51cfbd635377c38103f220520fb901b (diff) | |
download | serenity-bacbde31f3e4e2de48bce6848f6d7c610fe6a7be.zip |
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.
Diffstat (limited to 'Userland/Services/LookupServer/LookupServer.cpp')
-rw-r--r-- | Userland/Services/LookupServer/LookupServer.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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<String> 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(); |