Changeset 1429

Show
Ignore:
Timestamp:
11/04/09 09:21:07 (4 years ago)
Author:
gbastien
Message:
  • Fix #625, does not display failure notice when quiet is set to true
  • Fix #587, change index and rindex to strchr and strrchr
  • Fix #548, trim leading spaces of the config file's options
Location:
trunk/wifidog
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog/ChangeLog

    r1423 r1429  
    11# $Id$ 
     22009-11-03 
     3    * Fix #625, does not display failure notice when quiet is set to true 
     4    * Fix #587, change index and rindex to strchr and strrchr 
     5    * Fix #548, trim leading spaces of the config file's options 
     6 
    272009-09-28 Benoit Grégoire  <benoitg@coeus.ca> 
    38        * Fix #471, patch by  wichert 
  • trunk/wifidog/libhttpd/api.c

    r1423 r1429  
    472472                                        *end; 
    473473 
    474                                 var = index(buf,':'); 
     474                                var = strchr(buf,':'); 
    475475                                while(var) 
    476476                                { 
    477477                                        var++; 
    478                                         val = index(var, '='); 
     478                                        val = strchr(var, '='); 
    479479                                        *val = 0; 
    480480                                        val++; 
    481                                         end = index(val,';'); 
     481                                        end = strchr(val,';'); 
    482482                                        if(end) 
    483483                                                *end = 0; 
     
    490490                        if (strncasecmp(buf,"Authorization: ",15) == 0) 
    491491                        { 
    492                                 cp = index(buf,':') + 2; 
     492                                cp = strchr(buf,':') + 2; 
    493493                                if (strncmp(cp,"Basic ", 6) != 0) 
    494494                                { 
     
    499499                                        char    authBuf[100]; 
    500500 
    501                                         cp = index(cp,' ') + 1; 
     501                                        cp = strchr(cp,' ') + 1; 
    502502                                        _httpd_decode(cp, authBuf, 100); 
    503503                                        r->request.authLength =  
    504504                                                strlen(authBuf); 
    505                                         cp = index(authBuf,':'); 
     505                                        cp = strchr(authBuf,':'); 
    506506                                        if (cp) 
    507507                                        { 
     
    520520                        if (strncasecmp(buf,"Referer: ",9) == 0) 
    521521                        { 
    522                                 cp = index(buf,':') + 2; 
     522                                cp = strchr(buf,':') + 2; 
    523523                                if(cp) 
    524524                                { 
     
    533533                        if (strncasecmp(buf,"Host: ",6) == 0) 
    534534                        { 
    535                                 cp = index(buf,':'); 
     535                                cp = strchr(buf,':'); 
    536536                                if(cp) 
    537537                                { 
     
    546546                        if (strncasecmp(buf,"If-Modified-Since: ",19) == 0) 
    547547                        { 
    548                                 cp = index(buf,':') + 2; 
     548                                cp = strchr(buf,':') + 2; 
    549549                                if(cp) 
    550550                                { 
     
    552552                                                HTTP_MAX_URL); 
    553553                                        r->request.ifModified[HTTP_MAX_URL-1]=0; 
    554                                         cp = index(r->request.ifModified, 
     554                                        cp = strchr(r->request.ifModified, 
    555555                                                ';'); 
    556556                                        if (cp) 
     
    560560                        if (strncasecmp(buf,"Content-Type: ",14) == 0) 
    561561                        { 
    562                                 cp = index(buf,':') + 2; 
     562                                cp = strchr(buf,':') + 2; 
    563563                                if(cp) 
    564564                                { 
     
    570570                        if (strncasecmp(buf,"Content-Length: ",16) == 0) 
    571571                        { 
    572                                 cp = index(buf,':') + 2; 
     572                                cp = strchr(buf,':') + 2; 
    573573                                if(cp) 
    574574                                        r->request.contentLength=atoi(cp); 
     
    599599        ** Process any URL data 
    600600        */ 
    601         cp = index(r->request.path,'?'); 
     601        cp = strchr(r->request.path,'?'); 
    602602        if (cp != NULL) 
    603603        { 
     
    958958        strncpy(dirName, httpdRequestPath(r), HTTP_MAX_URL); 
    959959        dirName[HTTP_MAX_URL-1]=0; 
    960         cp = rindex(dirName, '/'); 
     960        cp = strrchr(dirName, '/'); 
    961961        if (cp == NULL) 
    962962        { 
  • trunk/wifidog/libhttpd/ip_acl.c

    r274 r1429  
    5353        cp = val; 
    5454        res1 = atoi(cp); 
    55         cp = index(cp,'.'); 
     55        cp = strchr(cp,'.'); 
    5656        if (!cp) 
    5757                return(-1); 
    5858        cp++; 
    5959        res2 = atoi(cp); 
    60         cp = index(cp,'.'); 
     60        cp = strchr(cp,'.'); 
    6161        if (!cp) 
    6262                return(-1); 
    6363        cp++; 
    6464        res3 = atoi(cp); 
    65         cp = index(cp,'.'); 
     65        cp = strchr(cp,'.'); 
    6666        if (!cp) 
    6767                return(-1); 
    6868        cp++; 
    6969        res4 = atoi(cp); 
    70         cp = index(cp,'/'); 
     70        cp = strchr(cp,'/'); 
    7171        if (!cp) 
    7272        { 
  • trunk/wifidog/libhttpd/protocol.c

    r1371 r1429  
    608608        struct  stat sbuf; 
    609609 
    610         suffix = rindex(path, '.'); 
     610        suffix = strrchr(path, '.'); 
    611611        if (suffix != NULL) 
    612612        { 
  • trunk/wifidog/src/conf.c

    r1373 r1429  
    634634        FILE *fd; 
    635635        char line[MAX_BUF], *s, *p1, *p2; 
    636         int linenum = 0, opcode, value; 
     636        int linenum = 0, opcode, value, len; 
    637637 
    638638        debug(LOG_INFO, "Reading configuration file '%s'", filename); 
     
    659659                if (p1) { 
    660660                        p1++; 
     661 
     662                        // Trim leading spaces 
     663                        len = strlen(p1); 
     664                        while (*p1 && len) { 
     665                                if (*p1 == ' ') 
     666                                        p1++; 
     667                                else 
     668                                        break; 
     669                                len = strlen(p1); 
     670                        } 
     671 
    661672 
    662673                        if ((p2 = strchr(p1, ' '))) { 
  • trunk/wifidog/src/fw_iptables.c

    r1420 r1429  
    113113        rc = execute(cmd, fw_quiet); 
    114114 
    115         if (rc!=0) 
    116                 debug(LOG_ERR, "iptables command failed(%d): %s", rc, cmd); 
     115        if (rc!=0) { 
     116                // If quiet, do not display the error 
     117                if (fw_quiet == 0) 
     118                        debug(LOG_ERR, "iptables command failed(%d): %s", rc, cmd); 
     119                else if (fw_quiet == 1) 
     120                        debug(LOG_DEBUG, "iptables command failed(%d): %s", rc, cmd); 
     121        } 
    117122 
    118123        free(cmd); 
  • trunk/wifidog/src/util.c

    r1381 r1429  
    115115                } else { 
    116116                        debug(LOG_ERR, "execvp() failed"); 
    117                 } 
    118                 exit(1); 
     117                } 
     118                exit(1); 
    119119        } 
    120120