From: bert hubert Date: Thu, 23 Mar 2017 20:39:10 +0000 (+0100) Subject: setKey() was actually "appendKey()". In addition, '-k' would not override for server... X-Git-Tag: rec-4.1.0-alpha1~162^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f6b4d6927b17ef25356f0fed9114ba69c2153e1;p=thirdparty%2Fpdns.git setKey() was actually "appendKey()". In addition, '-k' would not override for server configuration. Unified -k behaviour for client and server mode now. --- diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index fe0abd01be..7372ec3a85 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -1462,11 +1462,16 @@ vector> setupLua(bool client, const std::string& confi }); g_lua.writeFunction("setKey", [](const std::string& key) { + if(!g_configurationDone && ! g_key.empty()) { // this makes sure the commandline -k key prevails over dnsdist.conf + return; // but later setKeys() trump the -k value again + } + setLuaSideEffect(); + g_key.clear(); if(B64Decode(key, g_key) < 0) { - g_outputBuffer=string("Unable to decode ")+key+" as Base64"; - errlog("%s", g_outputBuffer); - } + g_outputBuffer=string("Unable to decode ")+key+" as Base64"; + errlog("%s", g_outputBuffer); + } }); diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 9e10eea904..cb77c3e2c1 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -1670,9 +1670,6 @@ struct string pidfile; string command; string config; -#ifdef HAVE_LIBSODIUM - string setKey; -#endif string uid; string gid; } g_cmdLine; @@ -1804,7 +1801,7 @@ try break; #ifdef HAVE_LIBSODIUM case 'k': - if (B64Decode(string(optarg), g_cmdLine.setKey) < 0) { + if (B64Decode(string(optarg), g_key) < 0) { cerr<<"Unable to decode key '"<