summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-28 01:38:33 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-28 01:38:33 +0000
commit4c3099bb6c186786858887730b896c6b96415b2a (patch)
treeb1910c5818df15c2e9aeb4d1a6b795d0742dfcdd
parentd40a402849595e51aff219b74c323008467ce67e (diff)
downloadhercules-4c3099bb6c186786858887730b896c6b96415b2a.tar.gz
hercules-4c3099bb6c186786858887730b896c6b96415b2a.tar.bz2
hercules-4c3099bb6c186786858887730b896c6b96415b2a.tar.xz
hercules-4c3099bb6c186786858887730b896c6b96415b2a.zip
* Resolving allow/deny IP rules not working (bugreport:2632).
- Fixed 'mask' being filled with 'ip' when standard mask was specified (since r9647). - Fixed 'ip' and 'mask' (bit mask) being stored in wrong byte order (network order instead of host order) (since r10162). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14683 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--src/common/socket.c5
-rw-r--r--src/common/socket.h1
3 files changed, 7 insertions, 3 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 71789519c..f113fd3f4 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,5 +1,9 @@
Date Added
+2011/01/27
+ * Resolving allow/deny IP rules not working (bugreport:2632). [Ai4rei]
+ - Fixed 'mask' being filled with 'ip' when standard mask was specified (since r9647).
+ - Fixed 'ip' and 'mask' (bit mask) being stored in wrong byte order (network order instead of host order) (since r10162).
2011/01/26
* Fixed buyers, that are currently in a vending shop could be fooled into buying an item at different price than they see by reopening the vending shop (bugreport:4728). [Ai4rei]
- This implements the official vending shop unique id handling (previously mistaken for char id), made compatible with packets before it's introduction (follow up to r14234).
diff --git a/src/common/socket.c b/src/common/socket.c
index 89c605c9d..ff667cf2e 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -996,10 +996,10 @@ int access_ipmask(const char* str, AccessControl* acc)
(n == 5 && m[0] > 32) ){ // invalid bit mask
return 0;
}
- ip = (uint32)(a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24));
+ ip = MAKEIP(a[0],a[1],a[2],a[3]);
if( n == 8 )
{// standard mask
- mask = (uint32)(a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24));
+ mask = MAKEIP(m[0],m[1],m[2],m[3]);
} else if( n == 5 )
{// bit mask
mask = 0;
@@ -1007,7 +1007,6 @@ int access_ipmask(const char* str, AccessControl* acc)
mask = (mask >> 1) | 0x80000000;
--m[0];
}
- mask = ntohl(mask);
} else
{// just this ip
mask = 0xFFFFFFFF;
diff --git a/src/common/socket.h b/src/common/socket.h
index 93a5dd796..0a740a63f 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -135,6 +135,7 @@ uint32 host2ip(const char* hostname);
const char* ip2str(uint32 ip, char ip_str[16]);
uint32 str2ip(const char* ip_str);
#define CONVIP(ip) ((ip)>>24)&0xFF,((ip)>>16)&0xFF,((ip)>>8)&0xFF,((ip)>>0)&0xFF
+#define MAKEIP(a,b,c,d) (uint32)( ( ( (a)&0xFF ) << 24 ) | ( ( (b)&0xFF ) << 16 ) | ( ( (c)&0xFF ) << 8 ) | ( ( (d)&0xFF ) << 0 ) )
uint16 ntows(uint16 netshort);
int socket_getips(uint32* ips, int max);