output-json: fix type of data parameter

The cast of data to AlertJsonThread was not correct as the real
type of the void pointer is a OutputJsonCtx. This was working by
luck because they both have a file_ctx as first element.
pull/1502/head
Eric Leblond 11 years ago committed by Victor Julien
parent f11e237d77
commit 39d667ff56

@ -571,7 +571,7 @@ static OutputCtx *JsonAlertLogInitCtx(ConfNode *conf)
*/
static OutputCtx *JsonAlertLogInitCtxSub(ConfNode *conf, OutputCtx *parent_ctx)
{
AlertJsonThread *ajt = parent_ctx->data;
OutputJsonCtx *ajt = parent_ctx->data;
AlertJsonOutputCtx *json_output_ctx = NULL;
HttpXFFCfg *xff_cfg = NULL;

@ -324,7 +324,7 @@ static void OutputFileLogDeinitSub(OutputCtx *output_ctx)
* */
OutputCtx *OutputFileLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
{
AlertJsonThread *ajt = parent_ctx->data;
OutputJsonCtx *ojc = parent_ctx->data;
OutputFileCtx *output_file_ctx = SCMalloc(sizeof(OutputFileCtx));
if (unlikely(output_file_ctx == NULL))
@ -336,7 +336,7 @@ OutputCtx *OutputFileLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
return NULL;
}
output_file_ctx->file_ctx = ajt->file_ctx;
output_file_ctx->file_ctx = ojc->file_ctx;
if (conf) {
const char *force_magic = ConfNodeLookupChildValue(conf, "force-magic");

@ -386,7 +386,7 @@ static void OutputFlowLogDeinitSub(OutputCtx *output_ctx)
OutputCtx *OutputFlowLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
{
AlertJsonThread *ajt = parent_ctx->data;
OutputJsonCtx *ojc = parent_ctx->data;
LogJsonFileCtx *flow_ctx = SCMalloc(sizeof(LogJsonFileCtx));
if (unlikely(flow_ctx == NULL))
@ -398,7 +398,7 @@ OutputCtx *OutputFlowLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
return NULL;
}
flow_ctx->file_ctx = ajt->file_ctx;
flow_ctx->file_ctx = ojc->file_ctx;
flow_ctx->flags = LOG_HTTP_DEFAULT;
output_ctx->data = flow_ctx;

@ -462,7 +462,7 @@ static void OutputHttpLogDeinitSub(OutputCtx *output_ctx)
OutputCtx *OutputHttpLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
{
AlertJsonThread *ajt = parent_ctx->data;
OutputJsonCtx *ojc = parent_ctx->data;
LogHttpFileCtx *http_ctx = SCMalloc(sizeof(LogHttpFileCtx));
if (unlikely(http_ctx == NULL))
@ -475,7 +475,7 @@ OutputCtx *OutputHttpLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
return NULL;
}
http_ctx->file_ctx = ajt->file_ctx;
http_ctx->file_ctx = ojc->file_ctx;
http_ctx->flags = LOG_HTTP_DEFAULT;
if (conf) {

@ -369,7 +369,7 @@ static void OutputNetFlowLogDeinitSub(OutputCtx *output_ctx)
OutputCtx *OutputNetFlowLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
{
AlertJsonThread *ajt = parent_ctx->data;
OutputJsonCtx *ojc = parent_ctx->data;
LogJsonFileCtx *flow_ctx = SCMalloc(sizeof(LogJsonFileCtx));
if (unlikely(flow_ctx == NULL))
@ -381,7 +381,7 @@ OutputCtx *OutputNetFlowLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
return NULL;
}
flow_ctx->file_ctx = ajt->file_ctx;
flow_ctx->file_ctx = ojc->file_ctx;
output_ctx->data = flow_ctx;
output_ctx->DeInit = OutputNetFlowLogDeinitSub;

@ -121,7 +121,7 @@ OutputCtx *OutputSmtpLogInit(ConfNode *conf)
static OutputCtx *OutputSmtpLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
{
AlertJsonThread *ajt = parent_ctx->data;
OutputJsonCtx *ojc = parent_ctx->data;
OutputJsonEmailCtx *email_ctx = SCMalloc(sizeof(OutputJsonEmailCtx));
if (unlikely(email_ctx == NULL))
@ -133,7 +133,7 @@ static OutputCtx *OutputSmtpLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
return NULL;
}
email_ctx->file_ctx = ajt->file_ctx;
email_ctx->file_ctx = ojc->file_ctx;
output_ctx->data = email_ctx;
output_ctx->DeInit = OutputSmtpLogDeInitCtxSub;

@ -248,7 +248,7 @@ static void OutputSshLogDeinitSub(OutputCtx *output_ctx)
OutputCtx *OutputSshLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
{
AlertJsonThread *ajt = parent_ctx->data;
OutputJsonCtx *ojc = parent_ctx->data;
if (OutputSshLoggerEnable() != 0) {
SCLogError(SC_ERR_CONF_YAML_ERROR, "only one 'ssh' logger "
@ -266,7 +266,7 @@ OutputCtx *OutputSshLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
return NULL;
}
ssh_ctx->file_ctx = ajt->file_ctx;
ssh_ctx->file_ctx = ojc->file_ctx;
output_ctx->data = ssh_ctx;
output_ctx->DeInit = OutputSshLogDeinitSub;

@ -292,7 +292,7 @@ static void OutputTlsLogDeinitSub(OutputCtx *output_ctx)
OutputCtx *OutputTlsLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
{
AlertJsonThread *ajt = parent_ctx->data;
OutputJsonCtx *ojc = parent_ctx->data;
if (OutputTlsLoggerEnable() != 0) {
SCLogError(SC_ERR_CONF_YAML_ERROR, "only one 'tls' logger "
@ -310,7 +310,7 @@ OutputCtx *OutputTlsLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
return NULL;
}
tls_ctx->file_ctx = ajt->file_ctx;
tls_ctx->file_ctx = ojc->file_ctx;
tls_ctx->flags = LOG_TLS_DEFAULT;
if (conf) {

Loading…
Cancel
Save