Skip to content

Commit ab7adc8

Browse files
committed
api key contest_id check
1 parent 03229f3 commit ab7adc8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/new_server_html.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9588,6 +9588,9 @@ priv_check_cached_key(struct http_request_info *phr)
95889588
if (phr->ssl_flag != cti->ssl_flag) {
95899589
break;
95909590
}
9591+
if (phr->contest_id > 0 && phr->contest_id != cti->contest_id) {
9592+
break;
9593+
}
95919594
if (cti->expiry_time > 0 && current_time >= cti->expiry_time) {
95929595
break;
95939596
}
@@ -9611,6 +9614,7 @@ priv_check_cached_key(struct http_request_info *phr)
96119614
if (cti && cti->used && cti->cmd == ULS_GET_API_KEY
96129615
&& !ej_ip_cmp(&phr->ip, &cti->origin_ip)
96139616
&& phr->ssl_flag == cti->ssl_flag
9617+
&& (phr->contest_id <= 0 || phr->contest_id == cti->contest_id)
96149618
&& (cti->expiry_time <= 0 || current_time < cti->expiry_time)
96159619
&& phr->role <= cti->role) {
96169620
copy_cti_to_phr(phr, cti, current_time);
@@ -9635,6 +9639,7 @@ priv_check_cached_key(struct http_request_info *phr)
96359639
if (cti && cti->used && cti->cmd == ULS_GET_API_KEY
96369640
&& !ej_ip_cmp(&phr->ip, &cti->origin_ip)
96379641
&& phr->ssl_flag == cti->ssl_flag
9642+
&& (phr->contest_id <= 0 || phr->contest_id == cti->contest_id)
96389643
&& (cti->expiry_time <= 0 || current_time < cti->expiry_time)
96399644
&& phr->role <= cti->role) {
96409645
copy_cti_to_phr(phr, cti, current_time);
@@ -16869,6 +16874,9 @@ unpriv_check_cached_key(struct http_request_info *phr)
1686916874
if (phr->ssl_flag != cti->ssl_flag) {
1687016875
break;
1687116876
}
16877+
if (phr->contest_id > 0 && phr->contest_id != cti->contest_id) {
16878+
break;
16879+
}
1687216880
if (cti->expiry_time > 0 && current_time >= cti->expiry_time) {
1687316881
break;
1687416882
}
@@ -16892,6 +16900,7 @@ unpriv_check_cached_key(struct http_request_info *phr)
1689216900
if (cti && cti->used && cti->cmd == ULS_GET_API_KEY
1689316901
&& !ej_ip_cmp(&phr->ip, &cti->origin_ip)
1689416902
&& phr->ssl_flag == cti->ssl_flag
16903+
&& (phr->contest_id <= 0 || phr->contest_id == cti->contest_id)
1689516904
&& (cti->expiry_time <= 0 || current_time < cti->expiry_time)
1689616905
&& phr->role <= cti->role) {
1689716906
copy_cti_to_phr(phr, cti, current_time);
@@ -16916,6 +16925,7 @@ unpriv_check_cached_key(struct http_request_info *phr)
1691616925
if (cti && cti->used && cti->cmd == ULS_GET_API_KEY
1691716926
&& !ej_ip_cmp(&phr->ip, &cti->origin_ip)
1691816927
&& phr->ssl_flag == cti->ssl_flag
16928+
&& (phr->contest_id <= 0 || phr->contest_id == cti->contest_id)
1691916929
&& (cti->expiry_time <= 0 || current_time < cti->expiry_time)
1692016930
&& phr->role <= cti->role) {
1692116931
copy_cti_to_phr(phr, cti, current_time);

0 commit comments

Comments
 (0)