mirror of
https://git.checksum.fail/alec/slon.git
synced 2025-12-08 12:09:55 +02:00
Slon/Modules/Api: Update whitelist_ip to specify multiple values
The whitelist_ip setting will now match on any value encapsulated by single quotes, regardless of delimiter.
This commit is contained in:
@@ -19,12 +19,11 @@ class SlonCatboxUpload {
|
|||||||
|
|
||||||
Bool @slon_api_authorized(SlonHttpSession* session)
|
Bool @slon_api_authorized(SlonHttpSession* session)
|
||||||
{
|
{
|
||||||
|
U8 scratch_buffer[256];
|
||||||
U8* whitelist_ip = db->o("settings")->@("whitelist_ip");
|
U8* whitelist_ip = db->o("settings")->@("whitelist_ip");
|
||||||
if (!whitelist_ip) {
|
if (whitelist_ip) {
|
||||||
return FALSE;
|
StrPrint(scratch_buffer, "'%s'", session->header("x-forwarded-for"));
|
||||||
}
|
return session->auth > 0 && StrFind(scratch_buffer, whitelist_ip);
|
||||||
if (StrICmp(session->header("x-forwarded-for"), whitelist_ip)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
return session->auth > 0;
|
return session->auth > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user