Changeset 943 for trunk/zoo-project


Ignore:
Timestamp:
Jun 27, 2019, 12:57:25 PM (5 months ago)
Author:
knut
Message:

Fix problem with the parsing of system environment variables (Windows version). Need to verify that problem does not pertain to non-Windows versions also.

Location:
trunk/zoo-project/zoo-kernel
Files:
4 edited

Legend:

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

    r929 r943  
    10011001 */
    10021002void printDescribeProcessForProcess(registry *reg, maps* m,xmlDocPtr doc,xmlNodePtr nc,service* serv){
    1003   xmlNsPtr ns,ns_ows,ns_xlink;
     1003  xmlNsPtr ns,ns_ows,ns_xlink; 
    10041004  xmlNodePtr n,nc1;
    10051005  xmlNodePtr nc2 = NULL;
  • trunk/zoo-project/zoo-kernel/service.c

    r917 r943  
    18091809// zooLogMsg(NULL, getLastErrorMessage());
    18101810// zooLogMsg("log.txt", getLastErrorMessage());
     1811
     1812#ifdef WIN32
     1813#ifndef USE_MS
     1814char *strcasestr (char const *a, char const *b)
     1815  {
     1816    char *x = zStrdup (a);
     1817    char *y = zStrdup (b);
     1818 
     1819      x = _strlwr (x);
     1820      y = _strlwr (y);
     1821    char *pos = strstr (x, y);
     1822    char *ret = pos == NULL ? NULL : (char *) (a + (pos - x));
     1823      free (x);
     1824      free (y);
     1825      return ret;
     1826  };
     1827#else
     1828   ;
     1829#endif
     1830#endif
  • trunk/zoo-project/zoo-kernel/service_internal_python.c

    r939 r943  
    236236          SetEnvironmentVariable("PYTHONHOME", home->value);
    237237  }
    238   char buffer[128];       
     238  char buffer[128];
    239239#endif 
    240240  if(hasToClean>0)
     
    254254#else
    255255  init_zoo();
    256 #endif  
     256#endif
    257257  mainstate = PyThreadState_Swap(NULL);
    258258  PyEval_ReleaseLock();
     
    285285    errorException (m, "Unable to parse serviceProvider please check your zcfg file.", "NoApplicableCode", NULL);
    286286    exit(-1);
    287   } 
    288   pModule = PyImport_Import(pName);   
     287  }
     288
     289  pModule = PyImport_Import(pName);
    289290  int res=SERVICE_FAILED;
    290291  if (pModule != NULL) {
     
    301302      PyTuple_SetItem(pArgs, 1, (PyObject *)arg2);
    302303      PyTuple_SetItem(pArgs, 2, (PyObject *)arg3);
    303       pValue = PyObject_CallObject(pFunc, pArgs);         
     304      pValue = PyObject_CallObject(pFunc, pArgs);
    304305      if (pValue != NULL) {
    305306        res=PyInt_AsLong(pValue);
     
    335336#endif
    336337  PyThreadState_Swap(mainstate);
    337   Py_Finalize(); 
     338  Py_Finalize();
    338339  return res;
    339340}
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r931 r943  
    509509#ifdef WIN32
    510510      HINSTANCE so =
    511         LoadLibraryEx (tmps1, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
     511        LoadLibraryEx (tmps1, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);                                             
    512512#else
    513513      void *so = dlopen (tmps1, RTLD_LAZY);
     
    974974runRequest (map ** inputs)
    975975{
    976  
     976       
    977977#ifndef USE_GDB
    978978#ifndef WIN32
     
    12821282
    12831283
    1284 
    12851284  service *s1;
    12861285  int scount = 0;
     
    13271326#endif
    13281327  }
    1329 
     1328 
    13301329  if (strncasecmp (REQUEST, "GetCapabilities", 15) == 0)
    1331     {
     1330    {   
    13321331#ifdef DEBUG
    13331332      dumpMap (r_inputs);
     
    13971396    }
    13981397  else
    1399     {
     1398    {     
    14001399      r_inputs = getMap (request_inputs, "JobId");
    14011400      if(reqId>nbReqIdentifier){
     
    15331532                          s1 = createService();
    15341533                          t = readServiceFile (m, import->value, &s1, import->name);
    1535                
     1534
    15361535                          if (t < 0) // failure reading zcfg
    15371536                            {
     
    15891588                        /**
    15901589                         * No support for dot in service name stored in metadb!?
    1591                          #ifdef META_DB
     1590                //       #ifdef META_DB
    15921591                         service* s2=extractServiceFromDb(m,tmpMapI->value,0);
    15931592                         if(s2==NULL){
    1594                          #endif
     1593                //       #endif
    15951594                        */
    15961595                        s1 = createService();
     
    18111810          }
    18121811        else if (strncasecmp (REQUEST, "Execute", strlen (REQUEST)) != 0)
    1813           {
     1812          {       
    18141813            map* version=getMapFromMaps(m,"main","rversion");
    18151814            int vid=getVersionId(version->value);           
     
    18681867      }
    18691868    }
    1870 
     1869       
    18711870  map *postRequest = NULL;
    18721871  postRequest = getMap (request_inputs, "xrequest");
     
    19511950                               "InternalError", NULL);
    19521951      }
    1953 
     1952 
    19541953    int saved_stdout = zDup (fileno (stdout));
    19551954    zDup2 (fileno (stderr), fileno (stdout));
     
    20842083  dumpMap (request_inputs);
    20852084#endif
    2086 
     2085 
    20872086  map *status = getMap (request_inputs, "status");
    20882087  if(vid==0){
     
    21652164  int eres = SERVICE_STARTED;
    21662165  int cpid = zGetpid ();
    2167 
     2166 
    21682167  // Create a map containing a copy of the request map
    21692168  maps *_tmpMaps = createMaps("request");
     
    22192218  else
    22202219    addToMap (_tmpMaps->content, "soap", "false");
    2221 
     2220 
    22222221  // Parse the session file and add it to the main maps
    22232222  char* originalCookie=NULL;
     
    22702269#endif
    22712270  int ei = 1;
    2272  
     2271 
     2272  _tmpMaps = createMaps("renv");       
     2273
    22732274#ifdef WIN32
    22742275  LPVOID orig = GetEnvironmentStrings();
    22752276  LPTSTR s = (LPTSTR) orig;
     2277 
     2278  while (*s != NULL) {
     2279    char* env = strdup(s);
     2280    char* delim = strchr(env,'=');
     2281    if (delim != NULL) {
     2282      char* val = delim+1;
     2283      *delim = '\0';           
     2284      if(_tmpMaps->content == NULL) {
     2285        _tmpMaps->content = createMap(env,val);
     2286      }
     2287      else {
     2288        addToMap(_tmpMaps->content,env,val);
     2289      }                 
     2290    }
     2291    s += strlen(s)+1;
     2292  }
     2293  FreeEnvironmentStrings((LPCH)orig);   
    22762294#else
    22772295  char **orig = environ;
    22782296  char *s=*orig;
    2279 #endif
    2280 
    2281   _tmpMaps = createMaps("renv");
    2282 if(orig!=NULL)
    2283   for (;
    2284 #ifdef WIN32
    2285        *s;
    2286        s++
    2287 #else
     2297 
     2298  if(orig!=NULL)
     2299    for (;
    22882300       s;
    22892301       ei++
    2290 #endif
    22912302       ) {
    22922303    if(strstr(s,"=")!=NULL && strlen(strstr(s,"="))>1){
     
    23032314      free(tmpName);
    23042315    }
    2305 #ifndef WIN32
    23062316    s = *(orig+ei);
    2307 #endif
    2308   }
     2317  } 
     2318#endif
     2319 
    23092320  if(_tmpMaps->content!=NULL && getMap(_tmpMaps->content,"HTTP_COOKIE")!=NULL){
    23102321    addToMap(_tmpMaps->content,"HTTP_COOKIE1",&cgiCookie[0]);
     
    23132324  freeMaps (&_tmpMaps);
    23142325  free (_tmpMaps);
    2315 #ifdef WIN32
    2316   FreeEnvironmentStrings((LPCH)orig);
    2317 #endif
     2326
    23182327  if(postRequest!=NULL)
    23192328    setMapInMaps (m, "renv", "xrequest", postRequest->value);
     
    23512360  if (status == NULLMAP)
    23522361    {
     2362         
    23532363      if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,&hInternet)<0){
    23542364        freeService (&s1);
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