mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2026-01-13 06:57:10 +03:00
Execute msr_log only if the debug log level is higher or equal to that of the log message.
This commit is contained in:
@@ -49,10 +49,18 @@ int parse_cookies_v0(modsec_rec *msr, char *_cookie_header, apr_table_t *cookies
|
|||||||
/* we ignore cookies with empty names */
|
/* we ignore cookies with empty names */
|
||||||
if ((attr_name != NULL)&&(strlen(attr_name) != 0)) {
|
if ((attr_name != NULL)&&(strlen(attr_name) != 0)) {
|
||||||
if (attr_value != NULL) {
|
if (attr_value != NULL) {
|
||||||
msr_log(msr, 5, "Adding request cookie: name \"%s\", value \"%s\"", log_escape(msr->mp, attr_name), log_escape(msr->mp, attr_value));
|
if (msr->txcfg->debuglog_level >= 5) {
|
||||||
|
msr_log(msr, 5, "Adding request cookie: name \"%s\", value \"%s\"",
|
||||||
|
log_escape(msr->mp, attr_name), log_escape(msr->mp, attr_value));
|
||||||
|
}
|
||||||
|
|
||||||
apr_table_add(cookies, attr_name, attr_value);
|
apr_table_add(cookies, attr_name, attr_value);
|
||||||
} else {
|
} else {
|
||||||
msr_log(msr, 5, "Adding request cookie: name \"%s\", value empty", log_escape(msr->mp, attr_name));
|
if (msr->txcfg->debuglog_level >= 5) {
|
||||||
|
msr_log(msr, 5, "Adding request cookie: name \"%s\", value empty",
|
||||||
|
log_escape(msr->mp, attr_name));
|
||||||
|
}
|
||||||
|
|
||||||
apr_table_add(cookies, attr_name, "");
|
apr_table_add(cookies, attr_name, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,12 +177,18 @@ int parse_cookies_v1(modsec_rec *msr, char *_cookie_header, apr_table_t *cookies
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (attr_value != NULL) {
|
if (attr_value != NULL) {
|
||||||
|
if (msr->txcfg->debuglog_level >= 5) {
|
||||||
msr_log(msr, 5, "Adding request cookie: name \"%s\", value \"%s\"",
|
msr_log(msr, 5, "Adding request cookie: name \"%s\", value \"%s\"",
|
||||||
log_escape(msr->mp, attr_name), log_escape(msr->mp, attr_value));
|
log_escape(msr->mp, attr_name), log_escape(msr->mp, attr_value));
|
||||||
|
}
|
||||||
|
|
||||||
apr_table_add(cookies, attr_name, attr_value);
|
apr_table_add(cookies, attr_name, attr_value);
|
||||||
} else {
|
} else {
|
||||||
|
if (msr->txcfg->debuglog_level >= 5) {
|
||||||
msr_log(msr, 5, "Adding request cookie: name \"%s\", value empty",
|
msr_log(msr, 5, "Adding request cookie: name \"%s\", value empty",
|
||||||
log_escape(msr->mp, attr_name));
|
log_escape(msr->mp, attr_name));
|
||||||
|
}
|
||||||
|
|
||||||
apr_table_add(cookies, attr_name, "");
|
apr_table_add(cookies, attr_name, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,9 +315,11 @@ int parse_arguments(modsec_rec *msr, const char *s, apr_size_t inputlength,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void add_argument(modsec_rec *msr, apr_table_t *arguments, msc_arg *arg) {
|
void add_argument(modsec_rec *msr, apr_table_t *arguments, msc_arg *arg) {
|
||||||
|
if (msr->txcfg->debuglog_level >= 5) {
|
||||||
msr_log(msr, 5, "Adding request argument (%s): name \"%s\", value \"%s\"",
|
msr_log(msr, 5, "Adding request argument (%s): name \"%s\", value \"%s\"",
|
||||||
arg->origin, log_escape_ex(msr->mp, arg->name, arg->name_len),
|
arg->origin, log_escape_ex(msr->mp, arg->name, arg->name_len),
|
||||||
log_escape_ex(msr->mp, arg->value, arg->value_len));
|
log_escape_ex(msr->mp, arg->value, arg->value_len));
|
||||||
|
}
|
||||||
|
|
||||||
apr_table_addn(arguments, log_escape_nq_ex(msr->mp, arg->name, arg->name_len), (void *)arg);
|
apr_table_addn(arguments, log_escape_nq_ex(msr->mp, arg->name, arg->name_len), (void *)arg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user