From de770d75636e218c2d2540a160d7c698015c8de2 Mon Sep 17 00:00:00 2001 From: frosch Date: Tue, 9 Oct 2012 20:36:31 +0000 Subject: (svn r24580) -Fix [FS#5308]: Do not add duplicates to the ban list. (alechz) --- src/network/network_server.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/network') diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index cd4e5f564..3464efa9c 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -2052,7 +2052,16 @@ uint NetworkServerKickOrBanIP(ClientID client_id, bool ban) uint NetworkServerKickOrBanIP(const char *ip, bool ban) { /* Add address to ban-list */ - if (ban) *_network_ban_list.Append() = strdup(ip); + if (ban) { + bool contains = false; + for (char **iter = _network_ban_list.Begin(); iter != _network_ban_list.End(); iter++) { + if (strcmp(*iter, ip) == 0) { + contains = true; + break; + } + } + if (!contains) *_network_ban_list.Append() = strdup(ip); + } uint n = 0; -- cgit v1.2.3-70-g09d2