From: Remi Gacogne Date: Tue, 8 Dec 2015 17:19:34 +0000 (+0100) Subject: Make the string parameter to testCrypto() optional. X-Git-Tag: dnsdist-1.0.0-alpha1~84^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3011%2Fhead;p=thirdparty%2Fpdns.git 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. --- 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;