Changeset 4209 for cherokee/trunk

Show
Ignore:
Timestamp:
08/02/10 12:34:26 (1 month ago)
Author:
alo
Message:

Fixes a parsing issue. The server might fail to start when "Allow
From" restrictions included IPv6 addresses or subnets.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/cherokee/access.c

    r4141 r4209  
    401401        int    mask; 
    402402        char   sep; 
    403  
    404         slash = strpbrk(ip_or_subnet, "/\\"); 
     403        int    colon; 
     404 
     405        slash = strpbrk (ip_or_subnet, "/\\"); 
     406        colon = (strchr (ip_or_subnet, ':') != NULL); 
    405407 
    406408        /* Add a single IP address 
     
    410412                int   is_domain = 0; 
    411413 
    412                 while (*i && !is_domain) { 
    413                         if (((*i >= 'a') && (*i <= 'z')) || 
    414                             ((*i >= 'A') && (*i <= 'Z'))) 
    415                                 is_domain = 1; 
    416                         i++; 
     414                if (! colon) { 
     415                        while (*i && !is_domain) { 
     416                                if (((*i >= 'a') && (*i <= 'z')) || 
     417                                    ((*i >= 'A') && (*i <= 'Z'))) { 
     418                                        is_domain = 1; 
     419                                } 
     420                                i++; 
     421                        } 
    417422                } 
    418423 
     
    427432        mask = atoi(slash+1); 
    428433 
    429         if ((strchr(ip_or_subnet, ':') != NULL) && (mask == 128)) { 
     434        if (colon && (mask == 128)) { 
    430435                sep = *slash; 
    431436                *slash = '\0';