1. Set WARN_UNUSED macro on DetectSignatureSetAppProto.
2. Replace all direct 'sets' of Signature::alproto from keyword registration.
Closes redmine ticket #3006.
sm_list = DETECT_SM_LIST_PMATCH;
}
- s->alproto = ALPROTO_DCERPC;
+ if (DetectSignatureSetAppProto(s, ALPROTO_DCERPC) < 0)
+ goto error;
s->flags |= SIG_FLAG_APPLAYER;
} else if (data->flags & DETECT_BYTE_EXTRACT_FLAG_RELATIVE) {
int result = 1;
- s->alproto = ALPROTO_DCERPC;
+ if (DetectSignatureSetAppProto(s, ALPROTO_DCERPC) < 0) {
+ SigFree(s);
+ return 0;
+ }
result &= (DetectBytejumpSetup(NULL, s, "4,0, align, multiplier 2, "
"post_offset -16,dce") == 0);
int result = 1;
- s->alproto = ALPROTO_DCERPC;
+ if (DetectSignatureSetAppProto(s, ALPROTO_DCERPC) < 0) {
+ SigFree(s);
+ return 0;
+ }
result &= (DetectBytetestSetup(NULL, s, "1,=,1,6,dce") == 0);
result &= (DetectBytetestSetup(NULL, s, "1,=,1,6,string,dce") == -1);
goto end;
}
- s->alproto = ALPROTO_DCERPC;
+ if (DetectSignatureSetAppProto(s, ALPROTO_DCERPC) < 0)
+ goto end;
result &= (DetectContentSetup(de_ctx, s, "one") == 0);
result &= (s->sm_lists[g_dce_stub_data_buffer_id] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);
if (DetectBufferSetActiveList(s, g_http_cookie_buffer_id) < 0)
return -1;
- s->alproto = ALPROTO_HTTP;
+ if (DetectSignatureSetAppProto(s, ALPROTO_HTTP) < 0)
+ return -1;
+
return 0;
}
{
if (DetectBufferSetActiveList(s, g_http_stat_code_buffer_id) < 0)
return -1;
- s->alproto = ALPROTO_HTTP;
+ if (DetectSignatureSetAppProto(s, ALPROTO_HTTP) < 0)
+ return -1;
return 0;
}
{
if (DetectBufferSetActiveList(s, g_http_stat_msg_buffer_id) < 0)
return -1;
- s->alproto = ALPROTO_HTTP;
+ if (DetectSignatureSetAppProto(s, ALPROTO_HTTP) < 0)
+ return -1;
return 0;
}
{
if (DetectBufferSetActiveList(s, g_http_uri_buffer_id) < 0)
return -1;
- s->alproto = ALPROTO_HTTP;
+ if (DetectSignatureSetAppProto(s, ALPROTO_HTTP) < 0)
+ return -1;
return 0;
}
{
if (DetectBufferSetActiveList(s, g_http_raw_uri_buffer_id) < 0)
return -1;
- s->alproto = ALPROTO_HTTP;
+ if (DetectSignatureSetAppProto(s, ALPROTO_HTTP) < 0)
+ return -1;
return 0;
}
Signature *s = SigAlloc();
int result = 1;
- s->alproto = ALPROTO_DCERPC;
+ if (DetectSignatureSetAppProto(s, ALPROTO_DCERPC) < 0) {
+ SigFree(s);
+ return 0;
+ }
result &= (DetectIsdataatSetup(NULL, s, "30") == 0);
result &= (s->sm_lists[g_dce_stub_data_buffer_id] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);
SigFree(s);
s = SigAlloc();
- s->alproto = ALPROTO_DCERPC;
+ if (DetectSignatureSetAppProto(s, ALPROTO_DCERPC) < 0) {
+ SigFree(s);
+ return 0;
+ }
/* failure since we have no preceding content/pcre/bytejump */
result &= (DetectIsdataatSetup(NULL, s, "30,relative") == 0);
result &= (s->sm_lists[g_dce_stub_data_buffer_id] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);
SigMatch *DetectGetLastSMByListId(const Signature *s, int list_id, ...);
int DetectSignatureAddTransform(Signature *s, int transform);
-int DetectSignatureSetAppProto(Signature *s, AppProto alproto);
+int WARN_UNUSED DetectSignatureSetAppProto(Signature *s, AppProto alproto);
/* parse regex setup and free util funcs */
DetectEngineCtx *de_ctx = DetectEngineCtxInit();
FAIL_IF_NULL(de_ctx);
- s->alproto = ALPROTO_DCERPC;
+ FAIL_IF(DetectSignatureSetAppProto(s, ALPROTO_DCERPC) < 0);
FAIL_IF_NOT(DetectPcreSetup(de_ctx, s, "/bamboo/") == 0);
FAIL_IF_NOT(s->sm_lists[g_dce_stub_data_buffer_id] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);
p->flowflags |= FLOW_PKT_ESTABLISHED;
p->flags |= PKT_HAS_FLOW|PKT_STREAM_EST;
f->alproto = ALPROTO_HTTP;
-
DetectEngineCtx *de_ctx = DetectEngineCtxInit();
FAIL_IF(de_ctx == NULL);