summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/network/network_server.cpp11
1 files changed, 10 insertions, 1 deletions
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;