summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorMadCamel <madcamel@gmail.com>2010-10-08 06:11:42 -0400
committerMadCamel <madcamel@gmail.com>2010-10-08 06:11:42 -0400
commit2239ad20a1420686bd58349ae4e364ecbc30d871 (patch)
tree61d81acdecf7a1a92a9dc398d4873d9a9b6a9f89 /src/map/pc.c
parent0a719c5441ddc14fad483e679edea900cd1e3789 (diff)
downloadtmwa-2239ad20a1420686bd58349ae4e364ecbc30d871.tar.gz
tmwa-2239ad20a1420686bd58349ae4e364ecbc30d871.tar.bz2
tmwa-2239ad20a1420686bd58349ae4e364ecbc30d871.tar.xz
tmwa-2239ad20a1420686bd58349ae4e364ecbc30d871.zip
map-server now stores IP address in session_data when player connects
This is to be used for @ipcheck, sending GMs IP identifiers, and clone blocking.
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 869d479..2b5dc3e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -761,6 +761,8 @@ int pc_authok (int id, int login_id2, time_t connect_until_time,
struct guild *g;
int i;
unsigned long tick = gettick ();
+ struct sockaddr_in sai;
+ socklen_t sa_len = sizeof(struct sockaddr);
sd = map_id2sd (id);
if (sd == NULL)
@@ -963,6 +965,10 @@ int pc_authok (int id, int login_id2, time_t connect_until_time,
memset(sd->flood_rates, 0, sizeof(sd->flood_rates));
sd->packet_flood_reset_due = sd->packet_flood_in = 0;
+ // Obtain IP address (if they are still connected)
+ if (!getpeername(sd->fd, (struct sockaddr *)&sai, &sa_len))
+ sd->ip = sai.sin_addr.s_addr;
+
// message of the limited time of the account
if (connect_until_time != 0)
{ // don't display if it's unlimited or unknow value