From 14f1f19dab3f41b5bcaeb40f63964c57eb1e25f2 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Thu, 5 Nov 2026 14:57:13 +0100 Subject: Step 2 of the WANT_RESTRICT_FULLSCRAPE feature (fixing a bug along the way) --- src/ot_http.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/ot_http.c') diff --git a/src/ot_http.c b/src/ot_http.c index d2dad67..cc11366 100644 --- a/src/ot_http.c +++ b/src/ot_http.c @@ -342,6 +342,10 @@ static ssize_t http_handle_stats(const int64_t sock, struct ot_workstruct *ws, c } if (mode == TASK_STATS_TPB) { +#ifdef WANT_RESTRICT_FULLSCRAPE + if (!accesslist_is_blessed(cookie->ip, OT_PERMISSION_MAY_FULLSCRAPE)) + HTTPERROR_403_IP; +#endif #ifdef WANT_COMPRESSION_GZIP ws->request[ws->request_size - 1] = 0; #ifndef WANT_COMPRESSION_GZIP_ALWAYS @@ -402,6 +406,9 @@ static ssize_t http_handle_fullscrape(const int64_t sock, struct ot_workstruct * struct http_data *cookie = fdstate_cookie(sock); int format = 0; + if (!cookie) + HTTPERROR_500; + #ifdef WANT_RESTRICT_FULLSCRAPE if (!accesslist_is_blessed(cookie->ip, OT_PERMISSION_MAY_FULLSCRAPE)) HTTPERROR_403_IP; -- cgit v1.3