SCReturnInt(r);
}
-DetectPcreData *DetectPcreParse (char *regexstr)
+DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx, char *regexstr)
{
int ec;
const char *eb;
int jit = 0;
ret = pcre_fullinfo(pd->re, pd->sd, PCRE_INFO_JIT, &jit);
if (ret != 0 || jit != 1) {
- SCLogWarning(SC_ERR_PCRE_STUDY, "PCRE JIT compiler does not support: %s", regexstr);
+ /* warning, so we won't print the sig after this. Adding
+ * file and line to the message so the admin can figure
+ * out what sig this is about */
+ SCLogWarning(SC_ERR_PCRE_STUDY, "PCRE JIT compiler does not support: %s. "
+ "Falling back to regular PCRE handling (%s:%d)",
+ regexstr, de_ctx->rule_file, de_ctx->rule_line);
}
#else
pd->sd = pcre_study(pd->re, 0, &eb);
SigMatch *sm = NULL;
SigMatch *prev_sm = NULL;
- pd = DetectPcreParse(regexstr);
+ pd = DetectPcreParse(de_ctx, regexstr);
if (pd == NULL)
goto error;
int result = 1;
DetectPcreData *pd = NULL;
char *teststring = "/blah/7";
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ if (de_ctx == NULL)
+ return 0;
- pd = DetectPcreParse(teststring);
+ pd = DetectPcreParse(de_ctx, teststring);
if (pd != NULL) {
printf("expected NULL: got %p", pd);
result = 0;
DetectPcreFree(pd);
}
+
+ DetectEngineCtxFree(de_ctx);
return result;
}
int result = 1;
DetectPcreData *pd = NULL;
char *teststring = "/blah/Ui$";
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ if (de_ctx == NULL)
+ return 0;
- pd = DetectPcreParse(teststring);
+ pd = DetectPcreParse(de_ctx, teststring);
if (pd != NULL) {
printf("expected NULL: got %p", pd);
result = 0;
DetectPcreFree(pd);
}
+ DetectEngineCtxFree(de_ctx);
return result;
}
int result = 1;
DetectPcreData *pd = NULL;
char *teststring = "/blah/UZi";
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ if (de_ctx == NULL)
+ return 0;
- pd = DetectPcreParse(teststring);
+ pd = DetectPcreParse(de_ctx, teststring);
if (pd != NULL) {
printf("expected NULL: got %p", pd);
result = 0;
DetectPcreFree(pd);
}
+ DetectEngineCtxFree(de_ctx);
return result;
}
int result = 1;
DetectPcreData *pd = NULL;
char *teststring = "/b\\\"lah/i";
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ if (de_ctx == NULL)
+ return 0;
- pd = DetectPcreParse(teststring);
+ pd = DetectPcreParse(de_ctx, teststring);
if (pd == NULL) {
printf("expected %p: got NULL", pd);
result = 0;
}
DetectPcreFree(pd);
+ DetectEngineCtxFree(de_ctx);
return result;
}
int result = 1;
DetectPcreData *pd = NULL;
char *teststring = "/b(l|a)h/";
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ if (de_ctx == NULL)
+ return 0;
- pd = DetectPcreParse(teststring);
+ pd = DetectPcreParse(de_ctx, teststring);
if (pd == NULL) {
printf("expected %p: got NULL", pd);
result = 0;
}
DetectPcreFree(pd);
+ DetectEngineCtxFree(de_ctx);
return result;
}
int result = 1;
DetectPcreData *pd = NULL;
char *teststring = "/b(l|a)h/smi";
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ if (de_ctx == NULL)
+ return 0;
- pd = DetectPcreParse(teststring);
+ pd = DetectPcreParse(de_ctx, teststring);
if (pd == NULL) {
printf("expected %p: got NULL", pd);
result = 0;
}
DetectPcreFree(pd);
+ DetectEngineCtxFree(de_ctx);
return result;
}
int result = 1;
DetectPcreData *pd = NULL;
char *teststring = "/blah/Ui";
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ if (de_ctx == NULL)
+ return 0;
- pd = DetectPcreParse(teststring);
+ pd = DetectPcreParse(de_ctx, teststring);
if (pd == NULL) {
printf("expected %p: got NULL", pd);
result = 0;
}
DetectPcreFree(pd);
+ DetectEngineCtxFree(de_ctx);
return result;
}
int result = 1;
DetectPcreData *pd = NULL;
char *teststring = "/b(l|a)h/O";
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ if (de_ctx == NULL)
+ return 0;
- pd = DetectPcreParse(teststring);
+ pd = DetectPcreParse(de_ctx, teststring);
if (pd == NULL) {
printf("expected %p: got NULL", pd);
result = 0;
}
DetectPcreFree(pd);
+ DetectEngineCtxFree(de_ctx);
return result;
}
int result = 1;
DetectPcreData *pd = NULL;
char *teststring = "/lala\\\\/";
+ DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ if (de_ctx == NULL)
+ return 0;
- pd = DetectPcreParse(teststring);
+ pd = DetectPcreParse(de_ctx, teststring);
if (pd == NULL) {
printf("expected %p: got NULL", pd);
result = 0;
}
DetectPcreFree(pd);
+ DetectEngineCtxFree(de_ctx);
return result;
}