summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-09 17:19:43 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-09 17:19:43 +0000
commit4bb106036bb644e33fe41340b3ae8f7b603c1210 (patch)
treec8342fee4adbdb925ef60607882273441ef04200
parent4d1b09949d8dfb0e111a2070486c79bb5ffbf971 (diff)
downloadhercules-4bb106036bb644e33fe41340b3ae8f7b603c1210.tar.gz
hercules-4bb106036bb644e33fe41340b3ae8f7b603c1210.tar.bz2
hercules-4bb106036bb644e33fe41340b3ae8f7b603c1210.tar.xz
hercules-4bb106036bb644e33fe41340b3ae8f7b603c1210.zip
small fix to the server's packet parsing code to display server IPs correctly.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11876 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/login/login.c7
-rw-r--r--src/login_sql/login.c14
-rw-r--r--src/map/clif.c3
3 files changed, 13 insertions, 11 deletions
diff --git a/src/login/login.c b/src/login/login.c
index 530d2eeda..a270a203a 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1024,8 +1024,7 @@ int mmo_auth(struct mmo_account* account, int fd)
char user_password[32+1]; // reserve for md5-ed pw
char ip[16];
- uint8* sin_addr = (uint8*)&session[fd]->client_addr;
- sprintf(ip, "%u.%u.%u.%u", sin_addr[3], sin_addr[2], sin_addr[1], sin_addr[0]);
+ ip2str(session[fd]->client_addr, ip);
// DNS Blacklist check
if( login_config.use_dnsbl )
@@ -1034,6 +1033,7 @@ int mmo_auth(struct mmo_account* account, int fd)
char ip_dnsbl[256];
char* dnsbl_serv;
bool matched = false;
+ uint8* sin_addr = (uint8*)&session[fd]->client_addr;
sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]);
@@ -1817,7 +1817,7 @@ int parse_login(int fd)
struct mmo_account account;
int result, j;
unsigned int i;
- uint32 ipl = session[fd]->client_addr;
+ uint32 ipl;
char ip[16];
if( session[fd]->eof )
@@ -1826,6 +1826,7 @@ int parse_login(int fd)
return 0;
}
+ ipl = login_config.login_ip;
ip2str(ipl, ip);
while( RFIFOREST(fd) >= 2 )
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 20be31a7b..2037ef463 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -440,8 +440,7 @@ int mmo_auth(struct mmo_account* account, int fd)
char* data;
char ip[16];
- uint8* sin_addr = (uint8*)&session[fd]->client_addr;
- sprintf(ip, "%u.%u.%u.%u", sin_addr[3], sin_addr[2], sin_addr[1], sin_addr[0]);
+ ip2str(session[fd]->client_addr, ip);
// DNS Blacklist check
if( login_config.use_dnsbl )
@@ -450,6 +449,7 @@ int mmo_auth(struct mmo_account* account, int fd)
char ip_dnsbl[256];
char* dnsbl_serv;
bool matched = false;
+ uint8* sin_addr = (uint8*)&session[fd]->client_addr;
sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]);
@@ -605,10 +605,8 @@ static int online_db_setoffline(DBKey key, void* data, va_list ap)
int parse_fromchar(int fd)
{
int i, id;
-
- uint32 ipl = session[fd]->client_addr;
+ uint32 ipl;
char ip[16];
- ip2str(ipl, ip);
ARR_FIND( 0, MAX_SERVERS, id, server[id].fd == fd );
if( id == MAX_SERVERS )
@@ -630,6 +628,9 @@ int parse_fromchar(int fd)
return 0;
}
+ ipl = server[id].ip;
+ ip2str(ipl, ip);
+
while( RFIFOREST(fd) >= 2 )
{
uint16 command = RFIFOW(fd,0);
@@ -1216,7 +1217,7 @@ int parse_login(int fd)
char esc_userid[NAME_LENGTH*2+1];// escaped username
struct mmo_account account;
int result, i;
- uint32 ipl = session[fd]->client_addr;
+ uint32 ipl;
char ip[16];
if( session[fd]->eof )
@@ -1225,6 +1226,7 @@ int parse_login(int fd)
return 0;
}
+ ipl = login_config.login_ip;
ip2str(ipl, ip);
while( RFIFOREST(fd) >= 2 )
diff --git a/src/map/clif.c b/src/map/clif.c
index e1f7b057b..8bf122a5f 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11529,8 +11529,7 @@ int clif_parse(int fd)
map_quit(sd);
}
} else {
- uint32 ip = session[fd]->client_addr;
- ShowInfo("Closed connection from '"CL_WHITE"%d.%d.%d.%d"CL_RESET"'.\n", CONVIP(ip));
+ ShowInfo("Closed connection from '"CL_WHITE"%s"CL_RESET"'.\n", ip2str(session[fd]->client_addr, NULL));
}
do_close(fd);
return 0;