diff options
author | MadCamel <madcamel@gmail.com> | 2010-10-08 07:30:52 -0400 |
---|---|---|
committer | MadCamel <madcamel@gmail.com> | 2010-10-08 07:30:52 -0400 |
commit | 8040f42b2e2b2ee95ef49f49d7ccf7d4eeb39201 (patch) | |
tree | 58d12d7da9583fe75f6b1284f9881df7f28be58a /src/map | |
parent | 2239ad20a1420686bd58349ae4e364ecbc30d871 (diff) | |
download | tmwa-8040f42b2e2b2ee95ef49f49d7ccf7d4eeb39201.tar.gz tmwa-8040f42b2e2b2ee95ef49f49d7ccf7d4eeb39201.tar.bz2 tmwa-8040f42b2e2b2ee95ef49f49d7ccf7d4eeb39201.tar.xz tmwa-8040f42b2e2b2ee95ef49f49d7ccf7d4eeb39201.zip |
Added IP address reply packet 0x20C (len 10)
This is sent along with char name replies to GMs able to recieve hack
notices. Unfortunately,it locks up clients that do not support this packet.
Must coordinate to get this added to TMW 0.5 release and mana. Until then,
code is commented out in clif.c(grep for MD5_ip)
Packet structure:
0x20C (len 2)
AccountID of character name was requested for (len 4)
IP address of requested char in network byte order (len 4)
Config option in battle_athena.conf:
gm_mask_ips (boolean) - When set to 1(default) GMs will only see a
hashed/masked IP address.
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/Makefile | 2 | ||||
-rw-r--r-- | src/map/battle.c | 10 | ||||
-rw-r--r-- | src/map/battle.h | 3 | ||||
-rw-r--r-- | src/map/chrif.c | 5 | ||||
-rw-r--r-- | src/map/chrif.h | 2 | ||||
-rw-r--r-- | src/map/clif.c | 19 |
6 files changed, 37 insertions, 4 deletions
diff --git a/src/map/Makefile b/src/map/Makefile index eb2f5fd..a1a4381 100644 --- a/src/map/Makefile +++ b/src/map/Makefile @@ -7,7 +7,7 @@ txt: obj map-server obj: mkdir obj -COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/grfio.o ../common/db.o ../common/lock.o ../common/nullpo.o ../common/malloc.o ../common/mt_rand.o +COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/grfio.o ../common/db.o ../common/lock.o ../common/nullpo.o ../common/malloc.o ../common/mt_rand.o ../common/md5calc.o LIBS = -lz -lm map-server: obj/tmw.o obj/magic-interpreter-lexer.o obj/magic-interpreter-parser.o obj/magic-interpreter-base.o obj/magic-expr.o obj/magic-stmt.o obj/magic.o obj/map.o obj/chrif.o obj/clif.o obj/pc.o obj/npc.o obj/chat.o obj/path.o obj/itemdb.o obj/mob.o obj/script.o obj/storage.o obj/skill.o obj/skill-pools.o obj/atcommand.o obj/battle.o obj/intif.o obj/trade.o obj/party.o obj/guild.o $(COMMON_OBJ) diff --git a/src/map/battle.c b/src/map/battle.c index ea284a5..9d868c7 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5657,6 +5657,7 @@ int battle_config_read (const char *cfgName) battle_config.packet_spam_flood = 30; battle_config.packet_spam_kick = 1; + battle_config.mask_ip_gms = 1; } fp = fopen_ (cfgName, "r"); @@ -6107,7 +6108,9 @@ int battle_config_read (const char *cfgName) { "packet_spam_flood", &battle_config.packet_spam_flood}, { - "packet_spam_kick", &battle_config.packet_spam_kick} + "packet_spam_kick", &battle_config.packet_spam_kick}, + { + "mask_ip_gms", &battle_config.mask_ip_gms} }; if (line[0] == '/' && line[1] == '/') @@ -6264,6 +6267,11 @@ int battle_config_read (const char *cfgName) else if (battle_config.packet_spam_kick > 1) battle_config.packet_spam_kick = 1; + if (battle_config.mask_ip_gms < 0) + battle_config.mask_ip_gms = 0; + else if (battle_config.mask_ip_gms > 1) + battle_config.mask_ip_gms = 1; + // at least 1 client must be accepted if ((battle_config.packet_ver_flag & 63) == 0) // added by [Yor] battle_config.packet_ver_flag = 63; // accept all clients diff --git a/src/map/battle.h b/src/map/battle.h index b155109..44016a5 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -344,8 +344,9 @@ extern struct Battle_Config int packet_spam_flood; int packet_spam_kick; - int drop_pickup_safety_zone; // [Fate] Max. distance to an object dropped by a kill by self in which dropsteal protection works + int mask_ip_gms; + int drop_pickup_safety_zone; // [Fate] Max. distance to an object dropped by a kill by self in which dropsteal protection works int itemheal_regeneration_factor; // [Fate] itemheal speed factor } battle_config; diff --git a/src/map/chrif.c b/src/map/chrif.c index 1f5673a..fd2398b 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -65,6 +65,11 @@ void chrif_setpasswd (char *pwd) passwd[sizeof(passwd)-1] = '\0'; } +char *chrif_getpasswd () +{ + return passwd; +} + /*========================================== * *------------------------------------------ diff --git a/src/map/chrif.h b/src/map/chrif.h index c3ae80d..3515463 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -4,6 +4,8 @@ void chrif_setuserid (char *); void chrif_setpasswd (char *); +char *chrif_getpasswd (); + void chrif_setip (char *); void chrif_setport (int); diff --git a/src/map/clif.c b/src/map/clif.c index 3cd01ee..1a1acf9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -23,6 +23,7 @@ #include "malloc.h" #include "version.h" #include "nullpo.h" +#include "md5calc.h" #include "atcommand.h" #include "battle.h" @@ -93,7 +94,7 @@ static const int packet_len_table[0x220] = { 30, 8, 34, 14, 2, 6, 26, 2, 28, 81, 6, 10, 26, 2, -1, -1, -1, -1, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56, -1, 4, 5, 10, //#0x200 - 26, -1, 26, 10, 18, 26, 11, 34, 14, 36, 10, 19, 0, -1, 24, 0, + 26, -1, 26, 10, 18, 26, 11, 34, 14, 36, 10, 19, 10, -1, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; @@ -7107,6 +7108,22 @@ void clif_parse_GetCharNameRequest (int fd, struct map_session_data *sd) } +#if 0 + if (pc_isGM(sd) > battle_config.hack_info_GM_level) + { + in_addr_t ip = ssd->ip; + WFIFOW (fd, 0) = 0x20C; + + // Mask the IP using the char-server password + if (battle_config.mask_ip_gms) + ip = MD5_ip(chrif_getpasswd (), ssd->ip); + + WFIFOL (fd, 2) = account_id; + WFIFOL (fd, 6) = ip; + WFIFOSET (fd, packet_len_table[0x20C]); + } +#endif + } break; case BL_NPC: |