void SCRConfReferenceHashFree(void *ch);
/* used to get the reference.config file path */
-static char *SCRConfGetConfFilename(void);
+static char *SCRConfGetConfFilename(const DetectEngineCtx *de_ctx);
void SCReferenceConfInit(void)
{
* instead use an input stream against a buffer containing the
* reference strings */
if (fd == NULL) {
- filename = SCRConfGetConfFilename();
+ filename = SCRConfGetConfFilename(de_ctx);
if ((fd = fopen(filename, "r")) == NULL) {
#ifdef UNITTESTS
if (RunmodeIsUnittests())
* \retval log_filename Pointer to a string containing the path for the
* reference.config file.
*/
-static char *SCRConfGetConfFilename(void)
+static char *SCRConfGetConfFilename(const DetectEngineCtx *de_ctx)
{
char *path = NULL;
- if (ConfGet("reference-config-file", &path) != 1) {
- return (char *)SC_RCONF_DEFAULT_FILE_PATH;
+ char config_value[256] = "";
+
+ if (de_ctx != NULL && strlen(de_ctx->config_prefix) > 0) {
+ snprintf(config_value, sizeof(config_value),
+ "%s.reference-config-file", de_ctx->config_prefix);
+
+ /* try loading prefix setting, fall back to global if that
+ * fails. */
+ if (ConfGet(config_value, &path) != 1) {
+ if (ConfGet("reference-config-file", &path) != 1) {
+ return (char *)SC_RCONF_DEFAULT_FILE_PATH;
+ }
+ }
+ } else {
+ if (ConfGet("reference-config-file", &path) != 1) {
+ return (char *)SC_RCONF_DEFAULT_FILE_PATH;
+ }
}
return path;
}