diff options
author | Eric Covener <covener@apache.org> | 2020-03-01 23:39:11 +0100 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2020-03-01 23:39:11 +0100 |
commit | 2c8a4fe01c2b8e4553a3cb397f9f59a44095d0a6 (patch) | |
tree | b8846f6b4155e0389d7957e8007fc25aecd80b7b /modules/session | |
parent | formatting [skip ci] (diff) | |
download | apache2-2c8a4fe01c2b8e4553a3cb397f9f59a44095d0a6.tar.xz apache2-2c8a4fe01c2b8e4553a3cb397f9f59a44095d0a6.zip |
PR56052: resolve problems with expired sessions
session_load providers cache the session_rec pointer, so hollow
them out and reuse them instead of replacing them.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874673 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/session')
-rw-r--r-- | modules/session/mod_session.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/modules/session/mod_session.c b/modules/session/mod_session.c index b72ab140c6..8a7c385a5a 100644 --- a/modules/session/mod_session.c +++ b/modules/session/mod_session.c @@ -137,23 +137,22 @@ static apr_status_t ap_session_load(request_rec * r, session_rec ** z) ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01817) "error while decoding the session, " "session not loaded: %s", r->uri); - zz = NULL; + /* preserve pointers to zz in load/save providers */ + memset(zz, 0, sizeof(session_rec)); + zz->pool = r->pool; + zz->entries = apr_table_make(zz->pool, 10); } /* invalidate session if session is expired */ if (zz && zz->expiry && zz->expiry < now) { ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "session is expired"); - zz = NULL; + /* preserve pointers to zz in load/save providers */ + memset(zz, 0, sizeof(session_rec)); + zz->pool = r->pool; + zz->entries = apr_table_make(zz->pool, 10); } } - /* no luck, create a blank session */ - if (!zz) { - zz = (session_rec *) apr_pcalloc(r->pool, sizeof(session_rec)); - zz->pool = r->pool; - zz->entries = apr_table_make(zz->pool, 10); - } - /* make sure the expiry and maxage are set, if present */ if (dconf->maxage) { if (!zz->expiry) { |