From 88a5d0cdda513357496b9d53878618e1620f47e8 Mon Sep 17 00:00:00 2001 From: ultramage Date: Thu, 5 Apr 2007 18:49:57 +0000 Subject: * Made a crazy attempt to at least partially synchronize login&char code * Major edit to the way the servers handle ip addresses, making them obey the "host byte order inside, network byte order outside" rule - hopefully covered all entry- and exit-points for IP address data - discovered several places where Gravity's client breaks the convention, will need to come up with a suitable countermeasure for that - other than that, the code should be portable, except for printing and ipban mask testing (those still assume a specific byte order) - tested both txt and sql in all usual situations; tested single- and multi-server setups, all seems to work (but watch out for hidden bugs!) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10162 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/pc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/map/pc.c') diff --git a/src/map/pc.c b/src/map/pc.c index 7ba8a8b87..24088ff61 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -698,20 +698,20 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t sd->state.event_kill_mob = 1; { //Add IP field - unsigned char *ip = (unsigned char *) &session[sd->fd]->client_addr.sin_addr; + uint32 ip = session[sd->fd]->client_addr; if (pc_isGM(sd)) ShowInfo("GM '"CL_WHITE"%s"CL_RESET"' logged in." " (AID/CID: '"CL_WHITE"%d/%d"CL_RESET"'," " Packet Ver: '"CL_WHITE"%d"CL_RESET"', IP: '"CL_WHITE"%d.%d.%d.%d"CL_RESET"'," " GM Level '"CL_WHITE"%d"CL_RESET"').\n", sd->status.name, sd->status.account_id, sd->status.char_id, - sd->packet_ver, ip[0],ip[1],ip[2],ip[3], pc_isGM(sd)); + sd->packet_ver, CONVIP(ip), pc_isGM(sd)); else ShowInfo("'"CL_WHITE"%s"CL_RESET"' logged in." " (AID/CID: '"CL_WHITE"%d/%d"CL_RESET"'," " Packet Ver: '"CL_WHITE"%d"CL_RESET"', IP: '"CL_WHITE"%d.%d.%d.%d"CL_RESET"').\n", sd->status.name, sd->status.account_id, sd->status.char_id, - sd->packet_ver, ip[0],ip[1],ip[2],ip[3]); + sd->packet_ver, CONVIP(ip)); } // Send friends list @@ -3371,10 +3371,11 @@ int pc_setpos(struct map_session_data *sd,unsigned short mapindex,int x,int y,in sd->regen.state.gc = 0; } - if(m<0){ - if(sd->mapindex){ - int ip,port; - if(map_mapname2ipport(mapindex,&ip,&port)==0){ + if(m<0) { + if(sd->mapindex) { + uint32 ip; + uint16 port; + if(map_mapname2ipport(mapindex,&ip,&port)==0) { unit_remove_map(&sd->bl,clrtype); sd->mapindex = mapindex; sd->bl.x=x; -- cgit v1.2.3-70-g09d2