From 0691977ea44fdccf46d752560b669cddf72e080b Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 21 Apr 2024 18:15:09 -0500 Subject: add a check for Blacklist --- src/slskd/Users/UserService.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/slskd') diff --git a/src/slskd/Users/UserService.cs b/src/slskd/Users/UserService.cs index 757d9333..2f718c7c 100644 --- a/src/slskd/Users/UserService.cs +++ b/src/slskd/Users/UserService.cs @@ -281,12 +281,20 @@ namespace slskd.Users return true; } - // todo: substitute this with a call to the managed blacklist + // check the user-curated list of blacklisted CIDRs that exists along with the list of + // blacklisted usernames. these CIDRs should be one-offs and would not be expected to appear in a + // blacklist supplied by a third party (but might?) if (ipAddress is not null && blacklist.Cidrs.Select(c => IPAddressRange.Parse(c)).Any(range => range.Contains(ipAddress))) { return true; } + // check the managed blacklist loaded from a third party blacklist file + if (ipAddress is not null && Blacklist.Contains(ipAddress)) + { + return true; + } + return false; } -- cgit v1.2.3