Ignore:
Timestamp:
Jan 14, 2013, 10:43:37 AM (12 years ago)
Author:
djay
Message:

Fix issue about reading session file when client send cookie not relative to the ZOO-Kernel.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r388 r390  
    21052105    addToMap(_tmpMaps->content,"soap","false");
    21062106  if(cgiCookie!=NULL && strlen(cgiCookie)>0){
     2107    int hasValidCookie=-1;
    21072108    char *tcook=strdup(cgiCookie);
    21082109    if(strstr(cgiCookie,";")>0){
     
    21142115            free(tcook);
    21152116          tcook=strdup(token);
     2117          hasValidCookie=1;
    21162118        }
    21172119        token=strtok_r(NULL,";",&saveptr);
    21182120      }
    21192121    }
    2120     addToMap(_tmpMaps->content,"sessid",strstr(tcook,"=")+1);
    2121     char session_file_path[1024];
    2122     map *tmpPath=getMapFromMaps(m,"main","sessPath");
    2123     if(tmpPath==NULL)
    2124       tmpPath=getMapFromMaps(m,"main","tmpPath");
    2125     char *tmp1=strtok(tcook,";");
    2126     if(tmp1!=NULL)
    2127       sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,strstr(tmp1,"=")+1);
    2128     else
    2129       sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,strstr(cgiCookie,"=")+1);
    2130     free(tcook);
    2131     maps *tmpSess=(maps*)malloc(MAPS_SIZE);
    2132     struct stat file_status;
    2133     int istat = stat(session_file_path, &file_status);
    2134     if(istat==0 && file_status.st_size>0){
    2135       conf_read(session_file_path,tmpSess);
    2136       addMapsToMaps(&m,tmpSess);
    2137       freeMaps(&tmpSess);
    2138     }else{
    2139       errorException(m, _("Unable to read your session file."), "InternalError");
    2140       freeMaps(&tmpSess);
    2141       freeService(&s1);
    2142       free(s1);
    2143       freeMaps(&m);
    2144       free(m);
    2145       freeMaps(&request_input_real_format);
    2146       free(request_input_real_format);
    2147       freeMaps(&request_output_real_format);
    2148       free(request_output_real_format);
    2149       free(REQUEST);
    2150       free(SERVICE_URL);
    2151       return 1;
    2152     }
    2153     free(tmpSess);
     2122    if(hasValidCookie>0){
     2123      addToMap(_tmpMaps->content,"sessid",strstr(tcook,"=")+1);
     2124      char session_file_path[1024];
     2125      map *tmpPath=getMapFromMaps(m,"main","sessPath");
     2126      if(tmpPath==NULL)
     2127        tmpPath=getMapFromMaps(m,"main","tmpPath");
     2128      char *tmp1=strtok(tcook,";");
     2129      if(tmp1!=NULL)
     2130        sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,strstr(tmp1,"=")+1);
     2131      else
     2132        sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,strstr(cgiCookie,"=")+1);
     2133      free(tcook);
     2134      maps *tmpSess=(maps*)malloc(MAPS_SIZE);
     2135      struct stat file_status;
     2136      int istat = stat(session_file_path, &file_status);
     2137      if(istat==0 && file_status.st_size>0){
     2138        conf_read(session_file_path,tmpSess);
     2139        addMapsToMaps(&m,tmpSess);
     2140        freeMaps(&tmpSess);
     2141      }else{
     2142        errorException(m, _("Unable to read your session file."), "InternalError");
     2143        free(tmpSess);
     2144        freeService(&s1);
     2145        free(s1);
     2146        freeMaps(&m);
     2147        free(m);
     2148        freeMaps(&request_input_real_format);
     2149        free(request_input_real_format);
     2150        freeMaps(&request_output_real_format);
     2151        free(request_output_real_format);
     2152        free(REQUEST);
     2153        free(SERVICE_URL);
     2154        return 1;
     2155      }
     2156      free(tmpSess);
     2157    }
    21542158  }
    21552159  addMapsToMaps(&m,_tmpMaps);
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png