mirror of
https://git.checksum.fail/alec/slon.git
synced 2025-12-08 20:19:56 +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)
|
||||
{
|
||||
U8 scratch_buffer[256];
|
||||
U8* whitelist_ip = db->o("settings")->@("whitelist_ip");
|
||||
if (!whitelist_ip) {
|
||||
return FALSE;
|
||||
}
|
||||
if (StrICmp(session->header("x-forwarded-for"), whitelist_ip)) {
|
||||
return FALSE;
|
||||
if (whitelist_ip) {
|
||||
StrPrint(scratch_buffer, "'%s'", session->header("x-forwarded-for"));
|
||||
return session->auth > 0 && StrFind(scratch_buffer, whitelist_ip);
|
||||
}
|
||||
return session->auth > 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user