|
|
@ -595,7 +595,7 @@ FILE *SCClassConfGenerateValidDummyClassConfigFD01(void)
|
|
|
|
|
|
|
|
|
|
|
|
FILE *fd = SCFmemopen((void *)buffer, strlen(buffer), "r");
|
|
|
|
FILE *fd = SCFmemopen((void *)buffer, strlen(buffer), "r");
|
|
|
|
if (fd == NULL)
|
|
|
|
if (fd == NULL)
|
|
|
|
SCLogDebug("Error with SCFmemopen() called by Classifiation Config test code");
|
|
|
|
SCLogDebug("Error with SCFmemopen() called by Classification Config test code");
|
|
|
|
|
|
|
|
|
|
|
|
return fd;
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -606,7 +606,7 @@ FILE *SCClassConfGenerateValidDummyClassConfigFD01(void)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* \file_path Pointer to the file_path for the dummy classification file.
|
|
|
|
* \file_path Pointer to the file_path for the dummy classification file.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
FILE *SCClassConfGenerateInValidDummyClassConfigFD02(void)
|
|
|
|
FILE *SCClassConfGenerateInvalidDummyClassConfigFD02(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const char *buffer =
|
|
|
|
const char *buffer =
|
|
|
|
"config classification: not-suspicious,Not Suspicious Traffic,3\n"
|
|
|
|
"config classification: not-suspicious,Not Suspicious Traffic,3\n"
|
|
|
@ -619,7 +619,7 @@ FILE *SCClassConfGenerateInValidDummyClassConfigFD02(void)
|
|
|
|
|
|
|
|
|
|
|
|
FILE *fd = SCFmemopen((void *)buffer, strlen(buffer), "r");
|
|
|
|
FILE *fd = SCFmemopen((void *)buffer, strlen(buffer), "r");
|
|
|
|
if (fd == NULL)
|
|
|
|
if (fd == NULL)
|
|
|
|
SCLogDebug("Error with SCFmemopen() called by Classifiation Config test code");
|
|
|
|
SCLogDebug("Error with SCFmemopen() called by Classification Config test code");
|
|
|
|
|
|
|
|
|
|
|
|
return fd;
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -630,7 +630,7 @@ FILE *SCClassConfGenerateInValidDummyClassConfigFD02(void)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* \file_path Pointer to the file_path for the dummy classification file.
|
|
|
|
* \file_path Pointer to the file_path for the dummy classification file.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
FILE *SCClassConfGenerateInValidDummyClassConfigFD03(void)
|
|
|
|
FILE *SCClassConfGenerateInvalidDummyClassConfigFD03(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const char *buffer =
|
|
|
|
const char *buffer =
|
|
|
|
"conig classification: not-suspicious,Not Suspicious Traffic,3\n"
|
|
|
|
"conig classification: not-suspicious,Not Suspicious Traffic,3\n"
|
|
|
@ -640,7 +640,7 @@ FILE *SCClassConfGenerateInValidDummyClassConfigFD03(void)
|
|
|
|
|
|
|
|
|
|
|
|
FILE *fd = SCFmemopen((void *)buffer, strlen(buffer), "r");
|
|
|
|
FILE *fd = SCFmemopen((void *)buffer, strlen(buffer), "r");
|
|
|
|
if (fd == NULL)
|
|
|
|
if (fd == NULL)
|
|
|
|
SCLogDebug("Error with SCFmemopen() called by Classifiation Config test code");
|
|
|
|
SCLogDebug("Error with SCFmemopen() called by Classification Config test code");
|
|
|
|
|
|
|
|
|
|
|
|
return fd;
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -683,7 +683,7 @@ static int SCClassConfTest02(void)
|
|
|
|
if (de_ctx == NULL)
|
|
|
|
if (de_ctx == NULL)
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
|
|
FILE *fd = SCClassConfGenerateInValidDummyClassConfigFD03();
|
|
|
|
FILE *fd = SCClassConfGenerateInvalidDummyClassConfigFD03();
|
|
|
|
SCClassConfLoadClassificationConfigFile(de_ctx, fd);
|
|
|
|
SCClassConfLoadClassificationConfigFile(de_ctx, fd);
|
|
|
|
|
|
|
|
|
|
|
|
if (de_ctx->class_conf_ht == NULL)
|
|
|
|
if (de_ctx->class_conf_ht == NULL)
|
|
|
@ -698,7 +698,7 @@ static int SCClassConfTest02(void)
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* \test Check that only valid classtypes are loaded into the hash table from
|
|
|
|
* \test Check that only valid classtypes are loaded into the hash table from
|
|
|
|
* the classfication.config file.
|
|
|
|
* the classification.config file.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static int SCClassConfTest03(void)
|
|
|
|
static int SCClassConfTest03(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -706,7 +706,7 @@ static int SCClassConfTest03(void)
|
|
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NULL(de_ctx);
|
|
|
|
FAIL_IF_NULL(de_ctx);
|
|
|
|
|
|
|
|
|
|
|
|
FILE *fd = SCClassConfGenerateInValidDummyClassConfigFD02();
|
|
|
|
FILE *fd = SCClassConfGenerateInvalidDummyClassConfigFD02();
|
|
|
|
FAIL_IF(SCClassConfLoadClassificationConfigFile(de_ctx, fd));
|
|
|
|
FAIL_IF(SCClassConfLoadClassificationConfigFile(de_ctx, fd));
|
|
|
|
|
|
|
|
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
@ -759,7 +759,7 @@ static int SCClassConfTest05(void)
|
|
|
|
if (de_ctx == NULL)
|
|
|
|
if (de_ctx == NULL)
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
FILE *fd = SCClassConfGenerateInValidDummyClassConfigFD03();
|
|
|
|
FILE *fd = SCClassConfGenerateInvalidDummyClassConfigFD03();
|
|
|
|
SCClassConfLoadClassificationConfigFile(de_ctx, fd);
|
|
|
|
SCClassConfLoadClassificationConfigFile(de_ctx, fd);
|
|
|
|
|
|
|
|
|
|
|
|
if (de_ctx->class_conf_ht == NULL)
|
|
|
|
if (de_ctx->class_conf_ht == NULL)
|
|
|
|