minor fixes

This commit is contained in:
Marc Stern 2024-04-10 14:04:34 +02:00
parent 5f938536a0
commit a01b9b527e
3 changed files with 11 additions and 6 deletions

View File

@ -32,8 +32,9 @@
// Returns the rule id if existing, otherwise the file name & line number // Returns the rule id if existing, otherwise the file name & line number
static const char* id_log(msre_rule* rule) { static const char* id_log(msre_rule* rule) {
const char* id = rule->actionset->id; char* id = rule->actionset->id;
if (!id || !*id || id == NOT_SET_P) id = apr_psprintf(rule->ruleset->mp, "%s (%d)", rule->filename, rule->line_num); if (id == NOT_SET_P || !id || !*id)
id = apr_psprintf(rule->ruleset->mp, "%s (%d)", rule->filename, rule->line_num);
return id; return id;
} }

View File

@ -168,7 +168,6 @@ static int fetch_target_exception(msre_rule *rule, modsec_rec *msr, msre_var *va
* \param p3 Pointer to configuration option REPLACED_TARGET * \param p3 Pointer to configuration option REPLACED_TARGET
*/ */
char *msre_ruleset_rule_update_target_matching_exception(modsec_rec *msr, msre_ruleset *ruleset, rule_exception *re, const char *p2, const char *p3) { char *msre_ruleset_rule_update_target_matching_exception(modsec_rec *msr, msre_ruleset *ruleset, rule_exception *re, const char *p2, const char *p3) {
assert(msr != NULL);
char *err; char *err;
if(ruleset == NULL) if(ruleset == NULL)
@ -210,7 +209,6 @@ char *msre_ruleset_phase_rule_update_target_matching_exception(modsec_rec *msr,
apr_array_header_t *phase_arr, const char *p2, apr_array_header_t *phase_arr, const char *p2,
const char *p3) const char *p3)
{ {
assert(msr != NULL);
assert(ruleset != NULL); assert(ruleset != NULL);
msre_rule **rules; msre_rule **rules;
int i, j, mode; int i, j, mode;
@ -245,7 +243,6 @@ char *msre_ruleset_phase_rule_update_target_matching_exception(modsec_rec *msr,
char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *rule, const char *p2, char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *rule, const char *p2,
const char *p3) { const char *p3) {
assert(msr != NULL);
assert(ruleset != NULL); assert(ruleset != NULL);
msre_var **targets = NULL; msre_var **targets = NULL;
@ -646,7 +643,10 @@ static char *msre_generate_target_string(apr_pool_t *pool, msre_rule *rule) {
/** /**
* Generate an action string from an actionset. * Generate an action string from an actionset.
*/ */
static char *msre_actionset_generate_action_string(apr_pool_t *pool, const msre_actionset *actionset) { #ifndef DEBUG_CONF
static
#endif
char *msre_actionset_generate_action_string(apr_pool_t *pool, const msre_actionset *actionset) {
const apr_array_header_t *tarr = NULL; const apr_array_header_t *tarr = NULL;
const apr_table_entry_t *telts = NULL; const apr_table_entry_t *telts = NULL;
char *actions = NULL; char *actions = NULL;

View File

@ -75,6 +75,10 @@ int DSOLOCAL rule_id_in_range(int ruleid, const char *range);
msre_var DSOLOCAL *generate_single_var(modsec_rec *msr, msre_var *var, apr_array_header_t *tfn_arr, msre_var DSOLOCAL *generate_single_var(modsec_rec *msr, msre_var *var, apr_array_header_t *tfn_arr,
msre_rule *rule, apr_pool_t *mptmp); msre_rule *rule, apr_pool_t *mptmp);
#ifdef DEBUG_CONF
char DSOLOCAL* msre_actionset_generate_action_string(apr_pool_t* pool, const msre_actionset* actionset);
#endif
#if defined(WITH_LUA) #if defined(WITH_LUA)
apr_table_t DSOLOCAL *generate_multi_var(modsec_rec *msr, msre_var *var, apr_array_header_t *tfn_arr, apr_table_t DSOLOCAL *generate_multi_var(modsec_rec *msr, msre_var *var, apr_array_header_t *tfn_arr,
msre_rule *rule, apr_pool_t *mptmp); msre_rule *rule, apr_pool_t *mptmp);