Skip to content

Commit d74505b

Browse files
committed
logout clears the session cache entry
1 parent 00cb2b1 commit d74505b

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

lib/new_server_html.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ extern const unsigned char * const ns_symbolic_action_table[];
126126

127127
static ContestExternalActionVector cnts_ext_actions;
128128

129+
struct id_cache main_id_cache;
130+
129131
static void
130132
error_page(
131133
FILE *out_f,
@@ -7532,6 +7534,15 @@ priv_logout(FILE *fout,
75327534
//unsigned char locale_buf[64];
75337535
unsigned char urlbuf[1024];
75347536

7537+
struct new_session_info del_item;
7538+
if (nsc_remove(&main_id_cache.s, phr->session_id, phr->client_key, &del_item)) {
7539+
xfree(del_item.login);
7540+
xfree(del_item.name);
7541+
if (del_item.user_info) {
7542+
userlist_free(&del_item.user_info->b);
7543+
}
7544+
}
7545+
75357546
if (ns_open_ul_connection(phr->fw_state) < 0)
75367547
return error_page(fout, phr, 0, NEW_SRV_ERR_USERLIST_SERVER_DOWN);
75377548
userlist_clnt_delete_cookie(ul_conn, phr->user_id,
@@ -13805,6 +13816,15 @@ unpriv_logout(FILE *fout,
1380513816
//unsigned char locale_buf[64];
1380613817
unsigned char urlbuf[1024];
1380713818

13819+
struct new_session_info del_item;
13820+
if (nsc_remove(&main_id_cache.s, phr->session_id, phr->client_key, &del_item)) {
13821+
xfree(del_item.login);
13822+
xfree(del_item.name);
13823+
if (del_item.user_info) {
13824+
userlist_free(&del_item.user_info->b);
13825+
}
13826+
}
13827+
1380813828
if (ns_open_ul_connection(phr->fw_state) < 0)
1380913829
return error_page(fout, phr, 0, NEW_SRV_ERR_USERLIST_SERVER_DOWN);
1381013830
userlist_clnt_delete_cookie(ul_conn, phr->user_id, phr->contest_id,
@@ -16547,8 +16567,6 @@ done:;
1654716567
cJSON_Delete(jr);
1654816568
}
1654916569

16550-
struct id_cache main_id_cache;
16551-
1655216570
static int
1655316571
ej_ip_cmp(const ej_ip_t *v1, const ej_ip_t *v2)
1655416572
{
@@ -16849,8 +16867,8 @@ unpriv_check_cached_session(struct http_request_info *phr)
1684916867
r = -NEW_SRV_ERR_INTERNAL;
1685016868
break;
1685116869
}
16852-
struct new_session_info del_item;
1685316870
if (nsi) {
16871+
struct new_session_info del_item;
1685416872
if (nsc_remove(&main_id_cache.s, phr->session_id, phr->client_key, &del_item)) {
1685516873
// del_item is moved item, the bucket is deleted
1685616874
xfree(del_item.login);

0 commit comments

Comments
 (0)