
cherokee at cherokee-project
Feb 8, 2010, 3:34 AM
Post #1 of 1
(66 views)
Permalink
|
|
[4209] cherokee/trunk/cherokee/access.c: Fixes a parsing issue.
|
|
Revision: 4209 http://svn.cherokee-project.com/changeset/4209 Author: alo Date: 2010-02-08 12:34:26 +0100 (Mon, 08 Feb 2010) Log Message: ----------- Fixes a parsing issue. The server might fail to start when "Allow From" restrictions included IPv6 addresses or subnets. Modified Paths: -------------- cherokee/trunk/cherokee/access.c Modified: cherokee/trunk/cherokee/access.c =================================================================== --- cherokee/trunk/cherokee/access.c 2010-02-06 14:31:41 UTC (rev 4208) +++ cherokee/trunk/cherokee/access.c 2010-02-08 11:34:26 UTC (rev 4209) @@ -400,8 +400,10 @@ char *slash; int mask; char sep; + int colon; - slash = strpbrk(ip_or_subnet, "/\\"); + slash = strpbrk (ip_or_subnet, "/\\"); + colon = (strchr (ip_or_subnet, ':') != NULL); /* Add a single IP address */ @@ -409,11 +411,14 @@ char *i = ip_or_subnet; int is_domain = 0; - while (*i && !is_domain) { - if (((*i >= 'a') && (*i <= 'z')) || - ((*i >= 'A') && (*i <= 'Z'))) - is_domain = 1; - i++; + if (! colon) { + while (*i && !is_domain) { + if (((*i >= 'a') && (*i <= 'z')) || + ((*i >= 'A') && (*i <= 'Z'))) { + is_domain = 1; + } + i++; + } } if (is_domain) @@ -426,7 +431,7 @@ */ mask = atoi(slash+1); - if ((strchr(ip_or_subnet, ':') != NULL) && (mask == 128)) { + if (colon && (mask == 128)) { sep = *slash; *slash = '\0'; ret = cherokee_access_add_ip (entry, ip_or_subnet);
|