diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-04-21 18:15:09 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2024-04-21 18:15:09 -0500 |
| commit | 0691977ea44fdccf46d752560b669cddf72e080b (patch) | |
| tree | bb524d720c11e3ecd864b1f4a59388fd8711aede /src | |
| parent | 4e2386deebe1bc5ede1d51aa29c126fc0f694c90 (diff) | |
| download | slskd-0691977ea44fdccf46d752560b669cddf72e080b.tar.gz | |
add a check for Blacklist
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Users/UserService.cs | 10 |
1 files changed, 9 insertions, 1 deletions
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; } |
