|
|
@ -590,11 +590,9 @@ static int PrefilterMpmFilemagicRegister(DetectEngineCtx *de_ctx,
|
|
|
|
static int DetectFilemagicTestParse01 (void)
|
|
|
|
static int DetectFilemagicTestParse01 (void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DetectFilemagicData *dnd = DetectFilemagicParse(NULL, "secret.pdf", false);
|
|
|
|
DetectFilemagicData *dnd = DetectFilemagicParse(NULL, "secret.pdf", false);
|
|
|
|
if (dnd != NULL) {
|
|
|
|
FAIL_IF_NULL(dnd);
|
|
|
|
DetectFilemagicFree(NULL, dnd);
|
|
|
|
DetectFilemagicFree(NULL, dnd);
|
|
|
|
return 1;
|
|
|
|
PASS;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -602,18 +600,12 @@ static int DetectFilemagicTestParse01 (void)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static int DetectFilemagicTestParse02 (void)
|
|
|
|
static int DetectFilemagicTestParse02 (void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int result = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DetectFilemagicData *dnd = DetectFilemagicParse(NULL, "backup.tar.gz", false);
|
|
|
|
DetectFilemagicData *dnd = DetectFilemagicParse(NULL, "backup.tar.gz", false);
|
|
|
|
if (dnd != NULL) {
|
|
|
|
FAIL_IF_NULL(dnd);
|
|
|
|
if (dnd->len == 13 && memcmp(dnd->name, "backup.tar.gz", 13) == 0) {
|
|
|
|
FAIL_IF_NOT(dnd->len == 13);
|
|
|
|
result = 1;
|
|
|
|
FAIL_IF_NOT(memcmp(dnd->name, "backup.tar.gz", 13) == 0);
|
|
|
|
}
|
|
|
|
DetectFilemagicFree(NULL, dnd);
|
|
|
|
|
|
|
|
PASS;
|
|
|
|
DetectFilemagicFree(NULL, dnd);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -621,18 +613,12 @@ static int DetectFilemagicTestParse02 (void)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static int DetectFilemagicTestParse03 (void)
|
|
|
|
static int DetectFilemagicTestParse03 (void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int result = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DetectFilemagicData *dnd = DetectFilemagicParse(NULL, "cmd.exe", false);
|
|
|
|
DetectFilemagicData *dnd = DetectFilemagicParse(NULL, "cmd.exe", false);
|
|
|
|
if (dnd != NULL) {
|
|
|
|
FAIL_IF_NULL(dnd);
|
|
|
|
if (dnd->len == 7 && memcmp(dnd->name, "cmd.exe", 7) == 0) {
|
|
|
|
FAIL_IF_NOT(dnd->len == 7);
|
|
|
|
result = 1;
|
|
|
|
FAIL_IF_NOT(memcmp(dnd->name, "cmd.exe", 7) == 0);
|
|
|
|
}
|
|
|
|
DetectFilemagicFree(NULL, dnd);
|
|
|
|
|
|
|
|
PASS;
|
|
|
|
DetectFilemagicFree(NULL, dnd);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|