From 107d4911a45d98f26b9a7d5442ac9da298122508 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 8 Dec 2015 18:19:34 +0100 Subject: [PATCH] Make the string parameter to testCrypto() optional. The documentation does not mention it and I don't think it makes sense to require one. Document the fact that makeKey() does return setKey('plaintext') without libsodium support. Reported by Charles-Henri Bruyand. --- pdns/README-dnsdist.md | 4 ++++ pdns/dnsdist-lua.cc | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pdns/README-dnsdist.md b/pdns/README-dnsdist.md index fefe3791c3..546c048aac 100644 --- a/pdns/README-dnsdist.md +++ b/pdns/README-dnsdist.md @@ -505,6 +505,10 @@ Then start `dnsdist` as a daemon, and then connect to it: > ``` +Please note that, without libsodium support, 'makeKey()' will return +setKey("plaintext") and the communication between the client and the +server will not be encrypted. + ACL, who can use dnsdist ------------------------ For safety reasons, by default only private networks can use dnsdist, see below diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 91983ee5c3..02128824bc 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -876,9 +876,18 @@ vector> setupLua(bool client, const std::string& confi }); - g_lua.writeFunction("testCrypto", [](string testmsg) + g_lua.writeFunction("testCrypto", [](boost::optional optTestMsg) { try { + string testmsg; + + if (optTestMsg) { + testmsg = *optTestMsg; + } + else { + testmsg = "testStringForCryptoTests"; + } + SodiumNonce sn, sn2; sn.init(); sn2=sn; -- 2.47.2