-/* Copyright (C) 2011-2014 Open Information Security Foundation
+/* Copyright (C) 2011-2022 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
" content:\"big\"; replace:\"pig\"; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"this is a pig test\"; sid:2;)";
- return DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF_NOT(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"th\"; offset: 4; replace:\"TH\"; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"THis\"; offset:4; sid:2;)";
- return DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF_NOT(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"th\"; replace:\"TH\"; offset: 4; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"THis\"; offset:4; sid:2;)";
- return DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF_NOT(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"th\"; replace:\"TH\"; content:\"patter\"; replace:\"matter\"; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"THis\"; content:\"matterns\"; sid:2;)";
- return DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF_NOT(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"th\"; replace:\"TH\"; content:\"nutella\"; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"TH\"; sid:2;)";
- return !DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"nutella\"; replace:\"commode\"; content:\"this is\"; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"commode\"; sid:2;)";
- return !DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"BiG\"; nocase; replace:\"pig\"; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"this is a pig test\"; sid:2;)";
- return DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF_NOT(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"big\"; depth:17; replace:\"pig\"; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"this is a pig test\"; sid:2;)";
- return DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF_NOT(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"big\"; depth:16; replace:\"pig\"; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"this is a pig test\"; sid:2;)";
- return !DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"big\"; depth:17; replace:\"pig\"; offset: 14; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"pig\"; depth:17; offset:14; sid:2;)";
- return DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF_NOT(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"big\"; replace:\"pig\"; content:\"to\"; within: 11; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"pig\"; depth:17; offset:14; sid:2;)";
- return DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+
+ FAIL_IF_NOT(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"big\"; replace:\"pig\"; content:\"to\"; within: 4; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"pig\"; depth:17; offset:14; sid:2;)";
- return !DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"big\"; replace:\"pig\"; content:\"test\"; distance: 1; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"pig\"; depth:17; offset:14; sid:2;)";
- return DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF_NOT(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"big\"; replace:\"pig\"; content:\"test\"; distance: 2; sid:1;)";
const char *sig_rep = "alert tcp any any -> any any (msg:\"replace worked\";"
" content:\"pig\"; depth:17; offset:14; sid:2;)";
- return !DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2);
+ FAIL_IF(DetectReplaceLongPatternMatchTestWrp(sig, 1, sig_rep, 2));
+ PASS;
}
/**
" content:\"com\"; replace:\"org\"; sid:1;)";
const char *sig_rep = "alert udp any any -> any any (msg:\"replace worked\";"
" content:\"twimg|03|org\"; sid:2;)";
- return DetectReplaceLongPatternMatchTestUDPWrp(sig, 1, sig_rep, 2);
+ FAIL_IF_NOT(DetectReplaceLongPatternMatchTestUDPWrp(sig, 1, sig_rep, 2));
+ PASS;
}
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
- DetectEngineCtx *de_ctx = NULL;
- int result = 1;
-
- de_ctx = DetectEngineCtxInit();
- if (de_ctx == NULL)
- goto end;
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ FAIL_IF_NULL(de_ctx);
de_ctx->flags |= DE_QUIET;
- de_ctx->sig_list = SigInit(de_ctx,
- "alert udp any any -> any any "
- "(msg:\"test\"; content:\"doh\"; replace:\"; sid:238012;)");
- if (de_ctx->sig_list != NULL) {
- result = 0;
- goto end;
- }
+ FAIL_IF_NOT_NULL(DetectEngineAppendSig(de_ctx,
+ "alert udp any any -> any any "
+ "(msg:\"test\"; content:\"doh\"; replace:\"; sid:238012;)"));
- end:
run_mode = run_mode_backup;
-
- SigGroupCleanup(de_ctx);
- SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx);
-
- return result;
+ PASS;
}
/**
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
- DetectEngineCtx *de_ctx = NULL;
- int result = 1;
-
- de_ctx = DetectEngineCtxInit();
- if (de_ctx == NULL)
- goto end;
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ FAIL_IF_NULL(de_ctx);
de_ctx->flags |= DE_QUIET;
- de_ctx->sig_list = SigInit(de_ctx,
- "alert http any any -> any any "
- "(msg:\"test\"; content:\"doh\"; replace:\"bon\"; sid:238012;)");
- if (de_ctx->sig_list == NULL) {
- result = 0;
- goto end;
- }
+ FAIL_IF_NULL(DetectEngineAppendSig(de_ctx,
+ "alert http any any -> any any "
+ "(msg:\"test\"; content:\"doh\"; replace:\"bon\"; sid:238012;)"));
- end:
run_mode = run_mode_backup;
-
- SigGroupCleanup(de_ctx);
- SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx);
-
- return result;
+ PASS;
}
/**
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
- DetectEngineCtx *de_ctx = NULL;
- int result = 1;
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
- de_ctx = DetectEngineCtxInit();
- if (de_ctx == NULL)
- goto end;
+ FAIL_IF_NULL(de_ctx);
de_ctx->flags |= DE_QUIET;
- de_ctx->sig_list = SigInit(de_ctx,
- "alert tcp any any -> any any "
- "(msg:\"test\"; content:\"doh\"; replace:\"don\"; http_header; sid:238012;)");
- if (de_ctx->sig_list != NULL) {
- result = 0;
- goto end;
- }
+ FAIL_IF_NOT_NULL(DetectEngineAppendSig(de_ctx,
+ "alert tcp any any -> any any "
+ "(msg:\"test\"; content:\"doh\"; replace:\"don\"; http_header; sid:238012;)"));
- end:
run_mode = run_mode_backup;
-
- SigGroupCleanup(de_ctx);
- SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx);
-
- return result;
+ PASS;
}
/**
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
- DetectEngineCtx *de_ctx = NULL;
- int result = 1;
-
- de_ctx = DetectEngineCtxInit();
- if (de_ctx == NULL)
- goto end;
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ FAIL_IF_NULL(de_ctx);
de_ctx->flags |= DE_QUIET;
- de_ctx->sig_list = SigInit(de_ctx,
- "alert tcp any any -> any any "
- "(msg:\"test\"; replace:\"don\"; sid:238012;)");
- if (de_ctx->sig_list != NULL) {
- result = 0;
- goto end;
- }
+ FAIL_IF_NOT_NULL(DetectEngineAppendSig(de_ctx, "alert tcp any any -> any any "
+ "(msg:\"test\"; replace:\"don\"; sid:238012;)"));
- end:
run_mode = run_mode_backup;
-
- SigGroupCleanup(de_ctx);
- SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx);
-
- return result;
+ PASS;
}
/**
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
- DetectEngineCtx *de_ctx = NULL;
- int result = 1;
-
- de_ctx = DetectEngineCtxInit();
- if (de_ctx == NULL)
- goto end;
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ FAIL_IF_NULL(de_ctx);
de_ctx->flags |= DE_QUIET;
- de_ctx->sig_list = SigInit(de_ctx,
- "alert tcp any any -> any any "
- "(msg:\"test\"; replace:\"don\"; content:\"doh\"; sid:238012;)");
- if (de_ctx->sig_list != NULL) {
- result = 0;
- goto end;
- }
+ FAIL_IF_NOT_NULL(DetectEngineAppendSig(de_ctx,
+ "alert tcp any any -> any any "
+ "(msg:\"test\"; replace:\"don\"; content:\"doh\"; sid:238012;)"));
- end:
run_mode = run_mode_backup;
-
- SigGroupCleanup(de_ctx);
- SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx);
-
- return result;
+ PASS;
}
/**
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
- DetectEngineCtx *de_ctx = NULL;
- int result = 1;
-
- de_ctx = DetectEngineCtxInit();
- if (de_ctx == NULL)
- goto end;
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ FAIL_IF_NULL(de_ctx);
de_ctx->flags |= DE_QUIET;
- de_ctx->sig_list = SigInit(de_ctx,
- "alert tcp any any -> any any "
- "(msg:\"test\"; content:\"don\"; replace:\"donut\"; sid:238012;)");
- if (de_ctx->sig_list != NULL) {
- result = 0;
- goto end;
- }
+ FAIL_IF_NOT_NULL(DetectEngineAppendSig(de_ctx,
+ "alert tcp any any -> any any "
+ "(msg:\"test\"; content:\"don\"; replace:\"donut\"; sid:238012;)"));
- end:
run_mode = run_mode_backup;
-
- SigGroupCleanup(de_ctx);
- SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx);
-
- return result;
+ PASS;
}
/**
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
- DetectEngineCtx *de_ctx = NULL;
- int result = 1;
-
- de_ctx = DetectEngineCtxInit();
- if (de_ctx == NULL)
- goto end;
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ FAIL_IF_NULL(de_ctx);
de_ctx->flags |= DE_QUIET;
- de_ctx->sig_list = SigInit(de_ctx,
- "alert tcp any any -> any any "
- "(msg:\"test\"; content:\"don\"; replace:\"dou\"; content:\"jpg\"; http_header; sid:238012;)");
- if (de_ctx->sig_list != NULL) {
- result = 0;
- goto end;
- }
+ FAIL_IF_NOT_NULL(
+ DetectEngineAppendSig(de_ctx, "alert tcp any any -> any any "
+ "(msg:\"test\"; content:\"don\"; replace:\"dou\"; "
+ "content:\"jpg\"; http_header; sid:238012;)"));
- end:
run_mode = run_mode_backup;
-
- SigGroupCleanup(de_ctx);
- SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx);
-
- return result;
+ PASS;
}
/**