summaryrefslogtreecommitdiff
path: root/src/common/ip.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-29 16:16:48 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-29 16:16:48 +0300
commit8867d978d868f6856cf0dd9eccbe1022c2814856 (patch)
tree6c22360c73d190826c685a4c2ca5f1e28c2dbc40 /src/common/ip.c
parent60833f07d7d563092570dbfdffaf1876921711d1 (diff)
downloadevol-hercules-8867d978d868f6856cf0dd9eccbe1022c2814856.tar.gz
evol-hercules-8867d978d868f6856cf0dd9eccbe1022c2814856.tar.bz2
evol-hercules-8867d978d868f6856cf0dd9eccbe1022c2814856.tar.xz
evol-hercules-8867d978d868f6856cf0dd9eccbe1022c2814856.zip
Improve inter server ip limit checks. Also move this check into common.
Diffstat (limited to 'src/common/ip.c')
-rw-r--r--src/common/ip.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/common/ip.c b/src/common/ip.c
new file mode 100644
index 0000000..bad4b61
--- /dev/null
+++ b/src/common/ip.c
@@ -0,0 +1,25 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../../../common/HPMi.h"
+#include "../../../common/malloc.h"
+#include "../../../common/mmo.h"
+#include "../../../common/socket.h"
+#include "../../../common/strlib.h"
+
+#include "common/ip.h"
+
+bool checkAllowedIp(const char* const mask, const char* const ip)
+{
+ char buf[1000];
+
+ strcpy(buf, ",");
+ strcat(buf, ip);
+ strcat(buf, ",");
+
+ return strstr(mask, buf) != NULL;
+}