From: Richard Sailer Date: Thu, 22 Feb 2018 00:53:16 +0000 (+0100) Subject: output/lua: better lua output setup error handling X-Git-Tag: suricata-4.1.0-beta1~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3272%2Fhead;p=thirdparty%2Fsuricata.git output/lua: better lua output setup error handling If suricata was started with --init-errors-fatal and an error occured during setup of lua output (like if lua scripts configured in the conf file don't exist or are not readable) suricata continued, which did not reflect "init errors fatal" very well. This fix makes the suricata initialization abort and send an error message in such cases. For details see: https://redmine.openinfosecfoundation.org/issues/1503 --- diff --git a/src/output-lua.c b/src/output-lua.c index 9ed0068799..8b5581c6c1 100644 --- a/src/output-lua.c +++ b/src/output-lua.c @@ -863,6 +863,18 @@ static OutputInitResult OutputLuaLogInit(ConfNode *conf) error: if (output_ctx->DeInit) output_ctx->DeInit(output_ctx); + + int failure_fatal = 0; + if (ConfGetBool("engine.init-failure-fatal", &failure_fatal) != 1) { + SCLogDebug("ConfGetBool could not load the value."); + } + if (failure_fatal) { + SCLogError(SC_ERR_LUA_ERROR, + "Error during setup of lua output. Details should be " + "described in previous error messages. Shutting down..."); + exit(EXIT_FAILURE); + } + return result; }