From 4bb106036bb644e33fe41340b3ae8f7b603c1210 Mon Sep 17 00:00:00 2001 From: ultramage Date: Sun, 9 Dec 2007 17:19:43 +0000 Subject: 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 --- src/login_sql/login.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/login_sql/login.c') 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 ) -- cgit v1.2.3-60-g2f50