* When we are sure all parts of the signature matched, we run this function
* to finalize the filestore.
*/
-int DetectFilestorePostMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx, Packet *p) {
+int DetectFilestorePostMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx, Packet *p, Signature *s) {
uint8_t flags = 0;
SCEnter();
SCReturnInt(0);
}
- if (det_ctx->filestore_sm == NULL || p->flow == NULL) {
+ if (s->filestore_sm == NULL || p->flow == NULL) {
#ifndef DEBUG
SCReturnInt(0);
#else
FileContainer *ffc = AppLayerGetFilesFromFlow(p->flow, flags);
/* filestore for single files only */
- if (det_ctx->filestore_sm->ctx == NULL) {
+ if (s->filestore_sm->ctx == NULL) {
uint16_t u;
for (u = 0; u < det_ctx->filestore_cnt; u++) {
FileStoreFileById(ffc, det_ctx->filestore[u].file_id);
}
} else {
- DetectFilestoreData *filestore = det_ctx->filestore_sm->ctx;
+ DetectFilestoreData *filestore = s->filestore_sm->ctx;
uint16_t u;
for (u = 0; u < det_ctx->filestore_cnt; u++) {
det_ctx->filestore[det_ctx->filestore_cnt].tx_id);
det_ctx->filestore_cnt++;
-
- det_ctx->filestore_sm = m;
SCReturnInt(1);
}
}
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_FILEMATCH);
+ s->filestore_sm = sm;
if (s->alproto != ALPROTO_UNKNOWN && s->alproto != ALPROTO_HTTP) {
SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS, "rule contains conflicting keywords.");
/* prototypes */
void DetectFilestoreRegister (void);
-int DetectFilestorePostMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx, Packet *p);
+int DetectFilestorePostMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx, Packet *p, Signature *);
#endif /* __DETECT_FILESTORE_H__ */
det_ctx->replist = NULL;
if (s->flags & SIG_FLAG_FILESTORE)
- DetectFilestorePostMatch(tv, det_ctx, p);
+ DetectFilestorePostMatch(tv, det_ctx, p, s);
return 1;
}
next:
DetectReplaceFree(det_ctx->replist);
det_ctx->replist = NULL;
- det_ctx->filestore_sm = NULL;
RULE_PROFILING_END(det_ctx, s, smatch);
det_ctx->flags = 0;
uint16_t sm_cnt;
SigMatch *dsize_sm;
+ SigMatch *filestore_sm;
/* the fast pattern added from this signature */
SigMatch *mpm_sm;
/* helper for init phase */
uint16_t file_id;
uint16_t tx_id;
} filestore[DETECT_FILESTORE_MAX];
- SigMatch *filestore_sm;
DetectEngineCtx *de_ctx;
#ifdef __SC_CUDA_SUPPORT__