small fix to the server's packet parsing code to display server IPs correctly.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11876 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-12-09 17:19:43 +00:00
parent de7e25a0bb
commit fc037d1e8a
3 changed files with 13 additions and 11 deletions

View File

@ -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 )

View File

@ -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 )

View File

@ -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;