dgaudet 97/11/08 13:33:09
Modified: src CHANGES src/modules/standard mod_access.c Log: Fix a byte ordering problem in mod_access which prevented the old-style syntax (i.e. "a.b.c." to match a class C) from working properly. [Dean Gaudet] PR: 1248, 1328, 1384 Reviewed by: Jim Jagielski, Lars Eilebrecht Revision Changes Path 1.496 +4 -0 apachen/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apachen/src/CHANGES,v retrieving revision 1.495 retrieving revision 1.496 diff -u -r1.495 -r1.496 --- CHANGES 1997/11/08 19:19:13 1.495 +++ CHANGES 1997/11/08 21:33:07 1.496 @@ -1,5 +1,9 @@ Changes with Apache 1.3b3 + *) Fix a byte ordering problem in mod_access which prevented + the old-style syntax (i.e. "a.b.c." to match a class C) + from working properly. [Dean Gaudet] PR#1248, 1328, 1384 + *) Fix problem with USE_FLOCK_SERIALIZED_ACCEPT not working properly. Each child needs to open the lockfile instead of using the passed file-descriptor from the parent. PR#1056 1.28 +15 -3 apachen/src/modules/standard/mod_access.c Index: mod_access.c =================================================================== RCS file: /export/home/cvs/apachen/src/modules/standard/mod_access.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- mod_access.c 1997/10/22 20:30:11 1.27 +++ mod_access.c 1997/11/08 21:33:09 1.28 @@ -204,12 +204,14 @@ /* legacy syntax for ip addrs: a.b.c. ==> a.b.c.0/24 for example */ int shift; char *t; + int octet; a->type = T_IP; /* parse components */ s = where; a->x.ip.net = 0; - shift = 0; + a->x.ip.mask = 0; + shift = 24; while (*s) { t = s; if (!isdigit(*t)) { @@ -226,11 +228,21 @@ a->type = T_FAIL; return "invalid ip address"; } - a->x.ip.net |= atoi(s) << shift; + if (shift < 0) { + return "invalid ip address, only 4 octets allowed"; + } + octet = atoi(s); + if (octet < 0 || octet > 255) { + a->type = T_FAIL; + return "each octet must be between 0 and 255 inclusive"; + } + a->x.ip.net |= octet << shift; a->x.ip.mask |= 0xFFUL << shift; - shift += 8; s = t; + shift -= 8; } + a->x.ip.net = ntohl(a->x.ip.net); + a->x.ip.mask = ntohl(a->x.ip.mask); } else { a->type = T_HOST;