summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-29 16:00:17 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-29 16:00:55 +0300
commit60833f07d7d563092570dbfdffaf1876921711d1 (patch)
treeb2303e729ff13f7d0f936a03f6e5620e74723395 /src/char/char.c
parentaa3110d092a545c027a4c568a9158e7c1210d547 (diff)
downloadevol-hercules-60833f07d7d563092570dbfdffaf1876921711d1.tar.gz
evol-hercules-60833f07d7d563092570dbfdffaf1876921711d1.tar.bz2
evol-hercules-60833f07d7d563092570dbfdffaf1876921711d1.tar.xz
evol-hercules-60833f07d7d563092570dbfdffaf1876921711d1.zip
char: add ability to filter inter servers connections by ip
New config option: inter_server_ip Example: inter_server_ip 127.0.0.1,127.0.0.2
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/char/char.c b/src/char/char.c
new file mode 100644
index 0000000..fc9dd2d
--- /dev/null
+++ b/src/char/char.c
@@ -0,0 +1,32 @@
+// 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 "../../../char/char.h"
+
+#include "char/char.h"
+#include "char/config.h"
+
+void echar_parse_char_login_map_server(int *fd)
+{
+ if (!inter_server_ip)
+ return;
+
+ const uint32 ipl = session[*fd]->client_addr;
+
+ const char *const ip = ip2str(ipl, NULL);
+ if (!strstr(inter_server_ip, ip))
+ {
+ hookStop();
+ ShowNotice("Connection of the map-server from ip %s REFUSED.\n", ip);
+ chr->login_map_server_ack(*fd, 3);
+ }
+}