Skip to content

Commit 35e97b5

Browse files
author
Marc Stern
committed
When there's a problem writing a collection key (it's too big for instance), we have no info on the involved key.
This adds the key name in the log (and its size, as this is the problem most of the time).
1 parent 569abcd commit 35e97b5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

apache2/apache2_config.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,9 @@ char *parser_conn_limits_operator(apr_pool_t *mp, const char *p2,
17491749

17501750
apr_filepath_merge(&file, config_orig_path, param, APR_FILEPATH_TRUENAME,
17511751
mp);
1752+
if (config_orig_path == NULL) {
1753+
return apr_psprintf(mp, "ModSecurity: failed to duplicate filename in parser_conn_limits_operator");
1754+
}
17521755

17531756
if ((strncasecmp(p2, "!@ipMatchFromFile", strlen("!@ipMatchFromFile")) == 0) ||
17541757
(strncasecmp(p2, "!@ipMatchF", strlen("!@ipMatchF")) == 0)) {

apache2/persist_dbm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,8 @@ int collection_store(modsec_rec *msr, apr_table_t *col) {
608608

609609
rc = apr_sdbm_store(dbm, key, value, APR_SDBM_REPLACE);
610610
if (rc != APR_SUCCESS) {
611-
msr_log(msr, 1, "collection_store: Failed to write to DBM file \"%s\": %s", dbm_filename,
612-
get_apr_error(msr->mp, rc));
611+
msr_log(msr, 1, "collection_store: Failed to write to DBM file \"%s\": %s (key=%s, length=%d)", dbm_filename,
612+
get_apr_error(msr->mp, rc), key.dptr, value.dsize);
613613
if (dbm != NULL) {
614614
#ifdef GLOBAL_COLLECTION_LOCK
615615
apr_sdbm_close(dbm);

0 commit comments

Comments
 (0)