Skip to content

Commit

Permalink
rules: use primary default-rule-path if set on command line
Browse files Browse the repository at this point in the history
When reloading rules, respect `--set default-rule-path=...` from the
command line if set.

Previously the rule reload would always take the default-rule-path from
the configuration file, even if overrided on the command line.

Issue: OISF#1911
(cherry picked from commit 3ea6572)
  • Loading branch information
jasonish authored and jlucovsky committed Feb 5, 2024
1 parent a31ff84 commit 39570d8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/detect-engine-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,17 @@ char *DetectLoadCompleteSigPath(const DetectEngineCtx *de_ctx, const char *sig_f
return NULL;
}

if (strlen(de_ctx->config_prefix) > 0) {
/* If we have a configuration prefix, only use it if the primary configuration node
* is not marked as final, as that means it was provided on the command line with
* a --set. */
ConfNode *default_rule_path = ConfGetNode("default-rule-path");
if ((!default_rule_path || !default_rule_path->final) && strlen(de_ctx->config_prefix) > 0) {
snprintf(varname, sizeof(varname), "%s.default-rule-path",
de_ctx->config_prefix);
} else {
snprintf(varname, sizeof(varname), "default-rule-path");
default_rule_path = ConfGetNode(varname);
}
if (default_rule_path) {
defaultpath = default_rule_path->val;
}

/* Path not specified */
Expand Down

0 comments on commit 39570d8

Please sign in to comment.