Skip to content

Commit 6f4d656

Browse files
csutherlFelipe Zimmerle
authored and
Felipe Zimmerle
committed
A better fix for #1273. With this in place the configuration doesn't need a change, but the session counts are 100% accurate.
1 parent a5bbb83 commit 6f4d656

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

apache2/modsecurity.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,13 @@ static void modsecurity_persist_data(modsec_rec *msr) {
223223

224224
/* Only store those collections that changed. */
225225
if (apr_table_get(msr->collections_dirty, te[i].key)) {
226-
collection_store(msr, col);
226+
if (msr->txcfg->debuglog_level >= 9) {
227+
msc_string *name = (msc_string *)apr_table_get(col, "__name");
228+
if (name != NULL) {
229+
msr_log(msr, 9, "Storing dirty collection %s at key %s", name->value, te[i].key);
230+
}
231+
}
232+
collection_store(msr, col, te[i].key);
227233
}
228234
}
229235

apache2/persist_dbm.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ apr_table_t *collection_retrieve(modsec_rec *msr, const char *col_name,
324324
/**
325325
*
326326
*/
327-
int collection_store(modsec_rec *msr, apr_table_t *col) {
327+
int collection_store(modsec_rec *msr, apr_table_t *col, const char *col_name) {
328328
char *dbm_filename = NULL;
329329
msc_string *var_name = NULL, *var_key = NULL;
330330
unsigned char *blob = NULL;
@@ -436,7 +436,7 @@ int collection_store(modsec_rec *msr, apr_table_t *col) {
436436

437437
/* If there is an original value, then create a delta and
438438
* apply the delta to the current value */
439-
orig_col = (const apr_table_t *)apr_table_get(msr->collections_original, var_name->value);
439+
orig_col = (const apr_table_t *)apr_table_get(msr->collections_original, col_name);
440440
if (orig_col != NULL) {
441441
if (msr->txcfg->debuglog_level >= 9) {
442442
msr_log(msr, 9, "collection_store: Re-retrieving collection prior to store: %s",

apache2/persist_dbm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
apr_table_t DSOLOCAL *collection_retrieve(modsec_rec *msr, const char *col_name,
2222
const char *col_value, int col_value_length);
2323

24-
int DSOLOCAL collection_store(modsec_rec *msr, apr_table_t *collection);
24+
int DSOLOCAL collection_store(modsec_rec *msr, apr_table_t *collection, const char *col_name);
2525

2626
int DSOLOCAL collections_remove_stale(modsec_rec *msr, const char *col_name);
2727

0 commit comments

Comments
 (0)