Skip to content
This repository was archived by the owner on Jan 28, 2020. It is now read-only.

Commit 013faf8

Browse files
committed
Fix session offset bug with creating new session.
When fixing the session offset calculation in 2299005, I forgot to update the logic for creating the new session. The result is that the code for creating new sessions use a different logic for calculating the session offset than the code for looking up sessions. This in turn means that we can only have a single session.
1 parent 86333fa commit 013faf8

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

auth_mellon_cache.c

+9-8
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ am_cache_entry_t *am_cache_new(server_rec *s, const char *key)
278278
{
279279
am_cache_entry_t *t;
280280
am_mod_cfg_rec *mod_cfg;
281-
am_cache_entry_t *table;
281+
void *table;
282282
apr_time_t current_time;
283283
int i;
284284
apr_time_t age;
@@ -313,33 +313,34 @@ am_cache_entry_t *am_cache_new(server_rec *s, const char *key)
313313
* initalize it to the first entry in the table to simplify the
314314
* following code (saves test for t == NULL).
315315
*/
316-
t = &table[0];
316+
t = am_cache_entry_ptr(mod_cfg, table, 0);;
317317

318318
/* Iterate over the session table. Update 't' to match the "best"
319319
* entry (the least recently used). 't' will point a free entry
320320
* if we find one. Otherwise, 't' will point to the least recently
321321
* used entry.
322322
*/
323323
for(i = 0; i < mod_cfg->init_cache_size; i++) {
324-
if(table[i].key[0] == '\0') {
324+
am_cache_entry_t *e = am_cache_entry_ptr(mod_cfg, table, i);
325+
if (e->key[0] == '\0') {
325326
/* This entry is free. Update 't' to this entry
326327
* and exit loop.
327328
*/
328-
t = &table[i];
329+
t = e;
329330
break;
330331
}
331332

332-
if(table[i].expires <= current_time) {
333+
if (e->expires <= current_time) {
333334
/* This entry is expired, and is therefore free.
334335
* Update 't' and exit loop.
335336
*/
336-
t = &table[i];
337+
t = e;
337338
break;
338339
}
339340

340-
if(table[i].access < t->access) {
341+
if (e->access < t->access) {
341342
/* This entry is older than 't' - update 't'. */
342-
t = &table[i];
343+
t = e;
343344
}
344345
}
345346

0 commit comments

Comments
 (0)