});
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);
+ }
});
string pidfile;
string command;
string config;
-#ifdef HAVE_LIBSODIUM
- string setKey;
-#endif
string uid;
string gid;
} g_cmdLine;
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 '"<<optarg<<"'."<<endl;
exit(EXIT_FAILURE);
}
setupLua(true, g_cmdLine.config);
if (clientAddress != ComboAddress())
g_serverControl = clientAddress;
-#ifdef HAVE_LIBSODIUM
- if (!g_cmdLine.setKey.empty())
- g_key = g_cmdLine.setKey;
-#endif
doClient(g_serverControl, g_cmdLine.command);
_exit(EXIT_SUCCESS);
}