From cec80bf80d0fa65ec9dcc977536ffeaa371db0e0 Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Tue, 7 May 2013 11:35:56 +0200 Subject: [PATCH 01/28] Fixing segfault for POST requests when no content-type is set. See issue #4650. --- mapows.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mapows.c b/mapows.c index cd30d9cd29..682b5d1d0b 100644 --- a/mapows.c +++ b/mapows.c @@ -95,7 +95,8 @@ static int msOWSPreParseRequest(cgiRequestObj *request, owsRequestObj *ows_request) { /* decide if KVP or XML */ - if (request->type == MS_GET_REQUEST || (request->type == MS_POST_REQUEST && strcmp(request->contenttype, "application/x-www-form-urlencoded")==0)) { + if (request->type == MS_GET_REQUEST || (request->type == MS_POST_REQUEST + && request->contenttype && EQUAL(request->contenttype, "application/x-www-form-urlencoded"))) { int i; /* parse KVP parameters service, version and request */ for (i = 0; i < request->NumParams; ++i) { From 937dcb6857501835b5489fa4bea321105412a20b Mon Sep 17 00:00:00 2001 From: Stephan Meissl Date: Tue, 7 May 2013 19:11:28 +0200 Subject: [PATCH 02/28] Resolving #4638. --- mapwms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mapwms.c b/mapwms.c index 2b96574c9f..e96c2eddfb 100644 --- a/mapwms.c +++ b/mapwms.c @@ -2446,7 +2446,7 @@ int msDumpLayer(mapObj *map, layerObj *lp, int nVersion, const char *script_url_ break; } } - if (l < lp2->numclasses) + if (lp2 && l < lp2->numclasses) break; } if (j < numNestedGroups[lp->index]) From 72a9a19831c2e434e7beb0fc55acadbfdc26cfd1 Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Tue, 4 Jun 2013 00:17:10 +0200 Subject: [PATCH 03/28] Handle Content-Type HTTP headers with a charset appended. The fix for #4585 in cgiutil.c is also needed in mapows.c to handle Content-Type HTTP headers with a charset appended. --- mapows.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mapows.c b/mapows.c index cd30d9cd29..17601179f3 100644 --- a/mapows.c +++ b/mapows.c @@ -95,7 +95,7 @@ static int msOWSPreParseRequest(cgiRequestObj *request, owsRequestObj *ows_request) { /* decide if KVP or XML */ - if (request->type == MS_GET_REQUEST || (request->type == MS_POST_REQUEST && strcmp(request->contenttype, "application/x-www-form-urlencoded")==0)) { + if (request->type == MS_GET_REQUEST || (request->type == MS_POST_REQUEST && strncmp(request->contenttype, "application/x-www-form-urlencoded", strlen("application/x-www-form-urlencoded")) == 0)) { int i; /* parse KVP parameters service, version and request */ for (i = 0; i < request->NumParams; ++i) { From d4df7b059b9f02e09ee5c68f527eb339664da8b4 Mon Sep 17 00:00:00 2001 From: Jerome Villeneuve Larouche Date: Thu, 30 May 2013 13:39:54 -0400 Subject: [PATCH 04/28] Small fix to shpxy in templates --- maptemplate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maptemplate.c b/maptemplate.c index 6b1e12b640..ef316449d0 100644 --- a/maptemplate.c +++ b/maptemplate.c @@ -2058,7 +2058,7 @@ static int processShpxyTag(layerObj *layer, char **line, shapeObj *shape) } /* build the per point format strings (version 1 contains the coordinate seperator, version 2 doesn't) */ - pointFormatLength = strlen("xh") + strlen("xf") + strlen("yh") + strlen("yf") + strlen("cs") + 10 + 1; + pointFormatLength = strlen(xh) + strlen(xf) + strlen(yh) + strlen(yf) + strlen(cs) + 12 + 1; pointFormat1 = (char *) msSmallMalloc(pointFormatLength); snprintf(pointFormat1, pointFormatLength, "%s%%.%dlf%s%s%%.%dlf%s%s", xh, precision, xf, yh, precision, yf, cs); pointFormat2 = (char *) msSmallMalloc(pointFormatLength); From dc3915db24d73d00e188c0537476eac6639853a6 Mon Sep 17 00:00:00 2001 From: Alan Boudreault Date: Fri, 14 Jun 2013 12:16:00 +0000 Subject: [PATCH 05/28] Fix segfault in ms_newMapObjFromString (PHP/MapScript) --- mapscript/php/php_mapscript.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mapscript/php/php_mapscript.c b/mapscript/php/php_mapscript.c index f757d9fac6..f1bd327d0b 100644 --- a/mapscript/php/php_mapscript.c +++ b/mapscript/php/php_mapscript.c @@ -169,7 +169,7 @@ PHP_FUNCTION(ms_newMapObjFromString) map = mapObj_newFromString(string, path); if (map == NULL) { - mapscript_throw_mapserver_exception("Failed to open map file \"%s\", or map file error." TSRMLS_CC, string); + mapscript_throw_mapserver_exception("Error while loading map file from string." TSRMLS_CC); return; } From 70a8c298edb84245321bd0080e21363ecc9a2fb3 Mon Sep 17 00:00:00 2001 From: Homme Zwaagstra Date: Wed, 26 Jun 2013 13:10:56 +0100 Subject: [PATCH 06/28] Replace `strlcpy` with `strncpy` in `msIO_stripStdoutBufferContentType()` The use of `strlcpy` was producing *uninitialised value* errors in valgrind. It appears this was due to the fact that `strlcpy` expects the source string to be null terminated which is not always the case in this context. --- mapio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mapio.c b/mapio.c index ac8cc5b26f..08612139a0 100644 --- a/mapio.c +++ b/mapio.c @@ -809,10 +809,13 @@ char *msIO_stripStdoutBufferContentType() } /* -------------------------------------------------------------------- */ - /* Copy out content type. */ + /* Copy out content type. Note we go against the coding guidelines */ + /* here and use strncpy() instead of strlcpy() as the source */ + /* buffer may not be NULL terminated - strlcpy() requires NULL */ + /* terminated sources (see issue #4672). */ /* -------------------------------------------------------------------- */ content_type = (char *) malloc(end_of_ct-14+2); - strlcpy( content_type, (const char *) buf->data + 14, end_of_ct - 14 + 2); + strncpy( content_type, (const char *) buf->data + 14, end_of_ct - 14 + 2); content_type[end_of_ct-14+1] = '\0'; /* -------------------------------------------------------------------- */ From cd774b3a9f07b8467702b4f0c01ead76e8ad9129 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 6 Jul 2013 14:45:48 +0200 Subject: [PATCH 07/28] Install postgresql-9.1-postgis-2.0-scripts in Travis due to packaging change of postgis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4f8d74a844..0ac495c6f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ before_install: - git submodule update --init --recursive - sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable - sudo apt-get update -qq - - sudo apt-get install -qq colordiff postgis libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-noxpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev php5-dev + - sudo apt-get install -qq colordiff postgis postgresql-9.1-postgis-2.0-scripts libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-noxpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev php5-dev - cd msautotest - ./create_postgis_test_data.sh - cd .. From 6e52ac04afd5d84bc5b08600faedd4f2e1674e8e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 6 Jul 2013 14:46:20 +0200 Subject: [PATCH 08/28] updated msautotest to latest branch-6-2 revision --- msautotest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msautotest b/msautotest index fff3a03428..e6e8a60042 160000 --- a/msautotest +++ b/msautotest @@ -1 +1 @@ -Subproject commit fff3a03428314ee517cc5bf20a5e4ee897a4f51d +Subproject commit e6e8a6004245548647617fe52ba8782f3468c59e From cc62353d3c446a18e1a69d684feea1745ab34b69 Mon Sep 17 00:00:00 2001 From: Luigi Pirelli Date: Wed, 10 Jul 2013 11:45:00 +0200 Subject: [PATCH 09/28] solved symbol size trunc bug thanks to tbonfort --- mapogcsld.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mapogcsld.c b/mapogcsld.c index 654175c475..1c6d5ba611 100644 --- a/mapogcsld.c +++ b/mapogcsld.c @@ -613,20 +613,20 @@ layerObj *msSLDParseSLD(mapObj *map, char *psSLDXML, int *pnLayers) } -int _msSLDParseSizeParameter(CPLXMLNode *psSize) +double _msSLDParseSizeParameter(CPLXMLNode *psSize) { - int nSize = 0; + double dSize = 0; CPLXMLNode *psLiteral = NULL; if (psSize) { psLiteral = CPLGetXMLNode(psSize, "Literal"); if (psLiteral && psLiteral->psChild && psLiteral->psChild->pszValue) - nSize = atof(psLiteral->psChild->pszValue); + dSize = atof(psLiteral->psChild->pszValue); else if (psSize->psChild && psSize->psChild->pszValue) - nSize = atof(psSize->psChild->pszValue); + dSize = atof(psSize->psChild->pszValue); } - return nSize; + return dSize; } /************************************************************************/ From 51c7a357bd48c23d08e350d45e4d47cf9694b0eb Mon Sep 17 00:00:00 2001 From: Luigi Pirelli Date: Mon, 15 Jul 2013 17:37:02 +0200 Subject: [PATCH 10/28] printed color alpha value in map file --- mapfile.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mapfile.c b/mapfile.c index 181f1519cb..918db02ba8 100644 --- a/mapfile.c +++ b/mapfile.c @@ -650,7 +650,17 @@ static void writeColor(FILE *stream, int indent, const char *name, colorObj *def #if ALPHACOLOR_ENABLED fprintf(stream, "%s %d %d %d\n", name, color->red, color->green, color->blue, color->alpha); #else - fprintf(stream, "%s %d %d %d\n", name, color->red, color->green, color->blue); + if(color->alpha != 255) { + char buffer[9]; + sprintf(buffer, "%02x", color->red); + sprintf(buffer+2, "%02x", color->green); + sprintf(buffer+4, "%02x", color->blue); + sprintf(buffer+6, "%02x", color->alpha); + *(buffer+8) = 0; + fprintf(stream, "%s \"#%s\"\n", name, buffer); + } else { + fprintf(stream, "%s %d %d %d\n", name, color->red, color->green, color->blue); + } #endif } From d72848eebd51ba2bba41b730db3e0dcf69b4b34b Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 17 Jul 2013 18:27:10 +0200 Subject: [PATCH 11/28] Add support for shapefiles with uppercase extension on Linux (#4712) --- mapshape.c | 17 +++++++++++++++-- maptree.c | 4 ++++ mapxbase.c | 15 +++++++++++---- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/mapshape.c b/mapshape.c index ea0f684c78..87deafdf66 100644 --- a/mapshape.c +++ b/mapshape.c @@ -249,6 +249,10 @@ SHPHandle msSHPOpen( const char * pszLayer, const char * pszAccess ) pszFullname = (char *) msSmallMalloc(strlen(pszBasename) + 5); sprintf( pszFullname, "%s.shp", pszBasename ); psSHP->fpSHP = fopen(pszFullname, pszAccess ); + if( psSHP->fpSHP == NULL ) { + sprintf( pszFullname, "%s.SHP", pszBasename ); + psSHP->fpSHP = fopen(pszFullname, pszAccess ); + } if( psSHP->fpSHP == NULL ) { msFree(pszBasename); msFree(pszFullname); @@ -258,6 +262,10 @@ SHPHandle msSHPOpen( const char * pszLayer, const char * pszAccess ) sprintf( pszFullname, "%s.shx", pszBasename ); psSHP->fpSHX = fopen(pszFullname, pszAccess ); + if( psSHP->fpSHX == NULL ) { + sprintf( pszFullname, "%s.SHX", pszBasename ); + psSHP->fpSHX = fopen(pszFullname, pszAccess ); + } if( psSHP->fpSHX == NULL ) { msFree(pszBasename); msFree(pszFullname); @@ -1753,9 +1761,14 @@ int msShapefileWhichShapes(shapefileObj *shpfile, rectObj rect, int debug) /* deal with case where sourcename is of the form 'file.shp' */ sourcename = msStrdup(shpfile->source); - /* TODO: need to add case-insensitive handling! */ s = strstr(sourcename, ".shp"); - if( s ) *s = '\0'; + if( s ) + *s = '\0'; + else { + s = strstr(sourcename, ".SHP"); + if( s ) + *s = '\0'; + } filename = (char *)malloc(strlen(sourcename)+strlen(MS_INDEX_EXTENSION)+1); MS_CHECK_ALLOC(filename, strlen(sourcename)+strlen(MS_INDEX_EXTENSION)+1, MS_FAILURE); diff --git a/maptree.c b/maptree.c index 178fb421c9..805a554dbe 100644 --- a/maptree.c +++ b/maptree.c @@ -126,6 +126,10 @@ SHPTreeHandle msSHPDiskTreeOpen(const char * pszTree, int debug) pszFullname = (char *) msSmallMalloc(strlen(pszBasename) + 5); sprintf( pszFullname, "%s%s", pszBasename, MS_INDEX_EXTENSION); psTree->fp = fopen(pszFullname, "rb" ); + if( psTree->fp == NULL ) { + sprintf( pszFullname, "%s.QIX", pszBasename); + psTree->fp = fopen(pszFullname, "rb" ); + } msFree(pszBasename); /* don't need these any more */ msFree(pszFullname); diff --git a/mapxbase.c b/mapxbase.c index 2dfc38a3c2..a667f5b125 100644 --- a/mapxbase.c +++ b/mapxbase.c @@ -162,11 +162,11 @@ DBFHandle msDBFOpen( const char * pszFilename, const char * pszAccess ) pszDBFFilename = (char *) msSmallMalloc(strlen(pszFilename)+1); strcpy( pszDBFFilename, pszFilename ); - if( strcmp(pszFilename+strlen(pszFilename)-4,".shp") - || strcmp(pszFilename+strlen(pszFilename)-4,".shx") ) { + if( strcmp(pszFilename+strlen(pszFilename)-4,".shp") == 0 + || strcmp(pszFilename+strlen(pszFilename)-4,".shx") == 0 ) { strcpy( pszDBFFilename+strlen(pszDBFFilename)-4, ".dbf"); - } else if( strcmp(pszFilename+strlen(pszFilename)-4,".SHP") - || strcmp(pszFilename+strlen(pszFilename)-4,".SHX") ) { + } else if( strcmp(pszFilename+strlen(pszFilename)-4,".SHP") == 0 + || strcmp(pszFilename+strlen(pszFilename)-4,".SHX") == 0 ) { strcpy( pszDBFFilename+strlen(pszDBFFilename)-4, ".DBF"); } @@ -176,6 +176,13 @@ DBFHandle msDBFOpen( const char * pszFilename, const char * pszAccess ) psDBF = (DBFHandle) calloc( 1, sizeof(DBFInfo) ); MS_CHECK_ALLOC(psDBF, sizeof(DBFInfo), NULL); psDBF->fp = fopen( pszDBFFilename, pszAccess ); + if( psDBF->fp == NULL ) + { + if( strcmp(pszDBFFilename+strlen(pszDBFFilename)-4,".dbf") == 0 ) { + strcpy( pszDBFFilename+strlen(pszDBFFilename)-4, ".DBF"); + psDBF->fp = fopen( pszDBFFilename, pszAccess ); + } + } if( psDBF->fp == NULL ) return( NULL ); From e3bd202852abaf892cb2d4516f3ff1fd2c9be489 Mon Sep 17 00:00:00 2001 From: Thomas Bonfort Date: Tue, 23 Jul 2013 15:56:12 +0200 Subject: [PATCH 12/28] avoid rendering symbols with 0 scale (#4654) sending in symbols with a 0 zero scale seems to mess up cairo, even though our use of cairo_save/cairo_restore should have taken care of this. --- maprendering.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/maprendering.c b/maprendering.c index 64f2a5b552..5a6169cb24 100644 --- a/maprendering.c +++ b/maprendering.c @@ -833,13 +833,15 @@ int msDrawMarkerSymbol(symbolSetObj *symbolset,imageObj *image, pointObj *p, sty break; } - s.style = style; computeSymbolStyle(&s,style,symbol,scalefactor,image->resolutionfactor); s.style = style; if (!s.color && !s.outlinecolor && symbol->type != MS_SYMBOL_PIXMAP && symbol->type != MS_SYMBOL_SVG) { return MS_SUCCESS; // nothing to do if no color, except for pixmap symbols } + if(s.scale == 0) { + return MS_SUCCESS; + } From 7e87f2c12562b237cc220c3121129a5db8404059 Mon Sep 17 00:00:00 2001 From: Thomas Bonfort Date: Wed, 24 Jul 2013 13:40:59 +0200 Subject: [PATCH 13/28] fix crashes on error'd WCS getcoverage requests (#4714) initialise msWCSGetCoverageMetadata20 to NULL to avoid memory failures on error --- mapwcs20.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mapwcs20.c b/mapwcs20.c index 33a282d6a2..8bd87b5240 100644 --- a/mapwcs20.c +++ b/mapwcs20.c @@ -1855,6 +1855,7 @@ static int msWCSGetCoverageMetadata20(layerObj *layer, wcs20coverageMetadataObj { char *srs_uri = NULL; int i = 0; + memset(cm,0,sizeof(wcs20coverageMetadataObj)); if ( msCheckParentPointer(layer->map,"map") == MS_FAILURE ) return MS_FAILURE; From 8d7380b0c6c074efc336796f0cedd66d73015f29 Mon Sep 17 00:00:00 2001 From: Stephan Meissl Date: Mon, 5 Aug 2013 17:31:04 +0200 Subject: [PATCH 14/28] Correcting version attribute in WCS exceptions (#4717). --- mapwcs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mapwcs.c b/mapwcs.c index ceacabf3da..99c48f6612 100644 --- a/mapwcs.c +++ b/mapwcs.c @@ -139,17 +139,18 @@ int msWCSException(mapObj *map, const char *code, const char *locator, { char *pszEncodedVal = NULL; const char *encoding; + char version_string[OWS_VERSION_MAXLEN]; if( version == NULL ) version = "1.0.0"; #if defined(USE_LIBXML2) if( msOWSParseVersionString(version) >= OWS_2_0_0 ) - return msWCSException20( map, code, locator, version ); + return msWCSException20( map, code, locator, msOWSGetVersionString(msOWSParseVersionString(version), version_string) ); #endif if( msOWSParseVersionString(version) >= OWS_1_1_0 ) - return msWCSException11( map, code, locator, version ); + return msWCSException11( map, code, locator, msOWSGetVersionString(msOWSParseVersionString(version), version_string) ); encoding = msOWSLookupMetadata(&(map->web.metadata), "CO", "encoding"); if (encoding) From e5fbb2025375708ac3e1e956bf4ee2814b9cde0f Mon Sep 17 00:00:00 2001 From: Stephan Meissl Date: Mon, 5 Aug 2013 18:00:04 +0200 Subject: [PATCH 15/28] update msautotest submodule --- msautotest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msautotest b/msautotest index e6e8a60042..ad84a2f9a5 160000 --- a/msautotest +++ b/msautotest @@ -1 +1 @@ -Subproject commit e6e8a6004245548647617fe52ba8782f3468c59e +Subproject commit ad84a2f9a51f0452817d5f075bd935bb4a45d96e From 84f505172f44e3bbb78304e253613e4aca317a28 Mon Sep 17 00:00:00 2001 From: Stephan Meissl Date: Mon, 5 Aug 2013 18:21:41 +0200 Subject: [PATCH 16/28] update msautotest submodule --- msautotest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msautotest b/msautotest index ad84a2f9a5..4d7002c68e 160000 --- a/msautotest +++ b/msautotest @@ -1 +1 @@ -Subproject commit ad84a2f9a51f0452817d5f075bd935bb4a45d96e +Subproject commit 4d7002c68e63ab683ebdd02b68e37805cf07b320 From dad572e62f8b8af1118b2f46dd89463d9ec84b2d Mon Sep 17 00:00:00 2001 From: Alan Boudreault Date: Tue, 6 Aug 2013 23:55:30 +0000 Subject: [PATCH 17/28] Fix Memory leak in UVRaster layers (#4706) --- mapuvraster.c | 93 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 39 deletions(-) diff --git a/mapuvraster.c b/mapuvraster.c index 6f6a04d7b6..296b41d011 100644 --- a/mapuvraster.c +++ b/mapuvraster.c @@ -333,13 +333,23 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) { uvRasterLayerInfo *uvlinfo = (uvRasterLayerInfo *) layer->layerinfo; imageObj *image_tmp; - mapObj map_tmp; + outputFormatObj *outputformat = NULL; + mapObj *map_tmp; double map_cellsize; unsigned int spacing; int width, height, u_src_off, v_src_off, i, x, y; char **alteredProcessing = NULL; char **savedProcessing = NULL; + /* + ** Allocate mapObj structure + */ + map_tmp = (mapObj *)msSmallCalloc(sizeof(mapObj),1); + if(initMap(map_tmp) == -1) { /* initialize this map */ + msFree(map_tmp); + return(MS_FAILURE); + } + if (layer->debug) msDebug("Entering msUVRASTERLayerWhichShapes().\n"); @@ -358,6 +368,7 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) "msUVRASTERLayerWhichShapes()" ); return MS_FAILURE; } + /* -------------------------------------------------------------------- */ /* Determine desired spacing. Default to 32 if not otherwise set */ /* -------------------------------------------------------------------- */ @@ -371,58 +382,59 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) height = (int)ceil(layer->map->height/spacing); map_cellsize = MS_MAX(MS_CELLSIZE(rect.minx, rect.maxx,layer->map->width), MS_CELLSIZE(rect.miny,rect.maxy,layer->map->height)); - map_tmp.cellsize = map_cellsize*spacing; + map_tmp->cellsize = map_cellsize*spacing; if (layer->debug) msDebug("msUVRASTERLayerWhichShapes(): width: %d, height: %d, cellsize: %g\n", - width, height, map_tmp.cellsize); + width, height, map_tmp->cellsize); /* Initialize our dummy map */ - MS_INIT_COLOR(map_tmp.imagecolor, 255,255,255,255); - map_tmp.resolution = layer->map->resolution; - map_tmp.defresolution = layer->map->defresolution; - map_tmp.outputformat = (outputFormatObj *) msSmallCalloc(1,sizeof(outputFormatObj)); - uvlinfo->band_count = map_tmp.outputformat->bands = 2; - map_tmp.outputformat->name = NULL; - map_tmp.outputformat->driver = NULL; - map_tmp.outputformat->refcount = 0; - map_tmp.outputformat->vtable = NULL; - map_tmp.outputformat->device = NULL; - map_tmp.outputformat->renderer = MS_RENDER_WITH_RAWDATA; - map_tmp.outputformat->imagemode = MS_IMAGEMODE_FLOAT32; - - map_tmp.configoptions = layer->map->configoptions; - map_tmp.mappath = layer->map->mappath; - map_tmp.shapepath = layer->map->shapepath; - map_tmp.extent.minx = rect.minx-(0.5*map_cellsize)+(0.5*map_tmp.cellsize); - map_tmp.extent.miny = rect.miny-(0.5*map_cellsize)+(0.5*map_tmp.cellsize); - map_tmp.extent.maxx = map_tmp.extent.minx+((width-1)*map_tmp.cellsize); - map_tmp.extent.maxy = map_tmp.extent.miny+((height-1)*map_tmp.cellsize); - map_tmp.gt.rotation_angle = 0.0; - - msInitProjection(&map_tmp.projection); - msCopyProjection(&map_tmp.projection, &layer->projection); + MS_INIT_COLOR(map_tmp->imagecolor, 255,255,255,255); + map_tmp->resolution = layer->map->resolution; + map_tmp->defresolution = layer->map->defresolution; + + outputformat = (outputFormatObj *) msSmallCalloc(1,sizeof(outputFormatObj)); + outputformat->bands = uvlinfo->band_count = 2; + outputformat->name = NULL; + outputformat->driver = NULL; + outputformat->refcount = 0; + outputformat->vtable = NULL; + outputformat->device = NULL; + outputformat->renderer = MS_RENDER_WITH_RAWDATA; + outputformat->imagemode = MS_IMAGEMODE_FLOAT32; + msAppendOutputFormat(map_tmp, outputformat); + + msCopyHashTable(map_tmp->configoptions, layer->map->configoptions); + map_tmp->mappath = msStrdup(layer->map->mappath); + map_tmp->shapepath = msStrdup(layer->map->shapepath); + map_tmp->extent.minx = rect.minx-(0.5*map_cellsize)+(0.5*map_tmp->cellsize); + map_tmp->extent.miny = rect.miny-(0.5*map_cellsize)+(0.5*map_tmp->cellsize); + map_tmp->extent.maxx = map_tmp->extent.minx+((width-1)*map_tmp->cellsize); + map_tmp->extent.maxy = map_tmp->extent.miny+((height-1)*map_tmp->cellsize); + map_tmp->gt.rotation_angle = 0.0; + + msCopyProjection(&map_tmp->projection, &layer->projection); if (layer->debug == 5) msDebug("msUVRASTERLayerWhichShapes(): extent: %g %d %g %g\n", - map_tmp.extent.minx, map_tmp.extent.miny, - map_tmp.extent.maxx, map_tmp.extent.maxy); + map_tmp->extent.minx, map_tmp->extent.miny, + map_tmp->extent.maxx, map_tmp->extent.maxy); /* important to use that function, to compute map geotransform, used by the resampling*/ - msMapSetSize(&map_tmp, width, height); + msMapSetSize(map_tmp, width, height); if (layer->debug == 5) msDebug("msUVRASTERLayerWhichShapes(): geotransform: %g %g %g %g %g %g\n", - map_tmp.gt.geotransform[0], map_tmp.gt.geotransform[1], - map_tmp.gt.geotransform[2], map_tmp.gt.geotransform[3], - map_tmp.gt.geotransform[4], map_tmp.gt.geotransform[5]); + map_tmp->gt.geotransform[0], map_tmp->gt.geotransform[1], + map_tmp->gt.geotransform[2], map_tmp->gt.geotransform[3], + map_tmp->gt.geotransform[4], map_tmp->gt.geotransform[5]); - uvlinfo->extent = map_tmp.extent; + uvlinfo->extent = map_tmp->extent; - image_tmp = msImageCreate(width, height, map_tmp.outputformat, - NULL, NULL, map_tmp.resolution, map_tmp.defresolution, - &(map_tmp.imagecolor)); + image_tmp = msImageCreate(width, height, map_tmp->outputformatlist[0], + NULL, NULL, map_tmp->resolution, map_tmp->defresolution, + &(map_tmp->imagecolor)); /* Default set to AVERAGE resampling */ if( CSLFetchNameValue( layer->processing, "RESAMPLE" ) == NULL ) { @@ -434,14 +446,16 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) layer->processing = alteredProcessing; } - if (msDrawRasterLayerLow(&map_tmp, layer, image_tmp, NULL ) == MS_FAILURE) { + if (msDrawRasterLayerLow(map_tmp, layer, image_tmp, NULL ) == MS_FAILURE) { msSetError(MS_MISCERR, "Unable to draw raster data.", NULL, "msUVRASTERLayerWhichShapes()" ); return MS_FAILURE; } /* restore the saved processing */ - if (alteredProcessing != NULL) + if (alteredProcessing != NULL) { layer->processing = savedProcessing; + CSLDestroy(alteredProcessing); + } /* free old query arrays */ if (uvlinfo->u) { @@ -484,6 +498,7 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) } msFreeImage(image_tmp); /* we do not need the imageObj anymore */ + msFreeMap(map_tmp); uvlinfo->next_shape = 0; From 5a0869a4eb0639fc4183d14df4c59581d0955ab0 Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Wed, 7 Aug 2013 12:17:13 +0200 Subject: [PATCH 18/28] Fixing interpretation of return value for `msWCSParseRequest20`. `MS_DONE` now means that the exception has already been written to the IO buffer. --- mapwcs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mapwcs.c b/mapwcs.c index 99c48f6612..cc35463300 100644 --- a/mapwcs.c +++ b/mapwcs.c @@ -2163,6 +2163,13 @@ int msWCSDispatch(mapObj *map, cgiRequestObj *request, owsRequestObj *ows_reques return msWCSException(map, "InvalidParameterValue", "request", "2.0.1"); } + else if (status == MS_DONE) { + /* MS_DONE means, that the exception has already been written to the IO + buffer. + */ + msWCSFreeParamsObj20(params); + return MS_FAILURE; + } } /* check if all layer names are valid NCNames */ From b420b71a2692ea0cb9c2dc73e763dc3d77d2dbcf Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Wed, 7 Aug 2013 12:21:40 +0200 Subject: [PATCH 19/28] Directly rendering exception messages during parsing. Wrong 'mediatype' values now produce exceptions. Fixing HTML status codes for various exception types. --- mapwcs20.c | 104 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 62 insertions(+), 42 deletions(-) diff --git a/mapwcs20.c b/mapwcs20.c index 8bd87b5240..6e49598888 100644 --- a/mapwcs20.c +++ b/mapwcs20.c @@ -667,7 +667,7 @@ static int msWCSParseRequest20_XMLDescribeCoverage( /************************************************************************/ #if defined(USE_LIBXML2) static int msWCSParseRequest20_XMLGetCoverage( - xmlNodePtr root, wcs20ParamsObjPtr params) + mapObj* map, xmlNodePtr root, wcs20ParamsObjPtr params) { xmlNodePtr child; int numIds = 0; @@ -696,6 +696,12 @@ static int msWCSParseRequest20_XMLGetCoverage( || EQUAL(content, "multipart/related"))) { params->multipart = MS_TRUE; } + else { + msSetError(MS_WCSERR, "Invalid value '%s' for parameter 'Mediatype'." + "msWCSParseRequest20()", content); + xmlFree(content); + return MS_FAILURE; + } xmlFree(content); } else if (EQUAL((char *) child->name, "DimensionTrim")) { wcs20AxisObjPtr axis = NULL; @@ -745,7 +751,8 @@ static int msWCSParseRequest20_XMLGetCoverage( if (msWCSParseSubset20(subset, axisName, crs, min, max) == MS_FAILURE) { msWCSFreeSubsetObj20(subset); - return MS_FAILURE; + msWCSException(map, "InvalidSubsetting", "subset", "2.0.1"); + return MS_DONE; } if(NULL == (axis = msWCSFindAxis20(params, subset->axis))) { @@ -923,14 +930,14 @@ int msWCSParseRequest20(mapObj *map, if(EQUAL(params->request, "DescribeCoverage")) { ret = msWCSParseRequest20_XMLDescribeCoverage(root, params); } else if(EQUAL(params->request, "GetCoverage")) { - ret = msWCSParseRequest20_XMLGetCoverage(root, params); + ret = msWCSParseRequest20_XMLGetCoverage(map, root, params); } } return ret; #else /* defined(USE_LIBXML2) */ /* TODO: maybe with CPLXML? */ - return MS_DONE; + return MS_FAILURE; #endif /* defined(USE_LIBXML2) */ } @@ -982,6 +989,11 @@ int msWCSParseRequest20(mapObj *map, if(EQUAL(value, "multipart/mixed") || EQUAL(value, "multipart/related")) { params->multipart = MS_TRUE; } + else { + msSetError(MS_WCSERR, "Invalid value '%s' for parameter 'Mediatype'." + "msWCSParseRequest20()", value); + return MS_FAILURE; + } } else if (EQUAL(key, "INTERPOLATION")) { params->interpolation = msStrdup(value); } else if (EQUAL(key, "OUTPUTCRS")) { @@ -1043,7 +1055,8 @@ int msWCSParseRequest20(mapObj *map, } if (msWCSParseSubsetKVPString20(subset, value) == MS_FAILURE) { msWCSFreeSubsetObj20(subset); - return MS_FAILURE; + msWCSException(map, "InvalidSubsetting", "subset", ows_request->version); + return MS_DONE; } if(NULL == (axis = msWCSFindAxis20(params, subset->axis))) { @@ -1058,7 +1071,8 @@ int msWCSParseRequest20(mapObj *map, msSetError(MS_WCSERR, "The axis '%s' is already subsetted.", "msWCSParseRequest20()", axis->name); msWCSFreeSubsetObj20(subset); - return MS_FAILURE; + msWCSException(map, "InvalidSubsetting", "subset", ows_request->version); + return MS_DONE; } axis->subset = subset; } else if(EQUAL(key, "RANGESUBSET")) { @@ -1087,12 +1101,17 @@ int msWCSParseRequest20(mapObj *map, /************************************************************************/ static int msWCSValidateAndFindAxes20( wcs20ParamsObjPtr params, - char*** validAxisNames, - int numAxis, wcs20AxisObjPtr outAxes[]) { + static const int numAxis = 2; + char *validXAxisNames[] = {"x", "xaxis", "x-axis", "x_axis", "long", "long_axis", "long-axis", "lon", "lon_axis", "lon-axis", NULL}; + char *validYAxisNames[] = {"y", "yaxis", "y-axis", "y_axis", "lat", "lat_axis", "lat-axis", NULL}; + char **validAxisNames[2]; int iParamAxis, iAcceptedAxis, iName, i; + validAxisNames[0] = validXAxisNames; + validAxisNames[1] = validYAxisNames; + for(i = 0; i < numAxis; ++i) { outAxes[i] = NULL; } @@ -1105,12 +1124,12 @@ static int msWCSValidateAndFindAxes20( if(params->axes[iParamAxis]->subset != NULL) { if(params->axes[iParamAxis]->subset->timeOrScalar == MS_WCS20_TIME_VALUE) { msSetError(MS_WCSERR, "Time values for subsets are not supported. ", - "msWCSCreateBoundingBox20()"); + "msWCSValidateAndFindAxes20()"); return MS_FAILURE; } if(params->axes[iParamAxis]->subset->operation == MS_WCS20_SLICE) { msSetError(MS_WCSERR, "Subset operation 'slice' is not supported.", - "msWCSCreateBoundingBox20()"); + "msWCSValidateAndFindAxes20()"); return MS_FAILURE; } } @@ -1125,7 +1144,7 @@ static int msWCSValidateAndFindAxes20( if(outAxes[iAcceptedAxis] != NULL) { msSetError(MS_WCSERR, "The axis with the name '%s' corresponds " "to the same axis as the subset with the name '%s'.", - "msWCSValidateAndFindSubsets20()", + "msWCSValidateAndFindAxes20()", outAxes[iAcceptedAxis]->name, params->axes[iParamAxis]->name); return MS_FAILURE; } @@ -1145,7 +1164,7 @@ static int msWCSValidateAndFindAxes20( /* exit and throw error */ if(found == 0) { msSetError(MS_WCSERR, "Invalid subset axis '%s'.", - "msWCSValidateAndFindSubsets20()", params->axes[iParamAxis]->name); + "msWCSValidateAndFindAxes20()", params->axes[iParamAxis]->name); return MS_FAILURE; } } @@ -2352,6 +2371,7 @@ int msWCSException20(mapObj *map, const char *exceptionCode, const char *locator, const char *version) { int size = 0; + char *status = "400 Bad Request"; char *errorString = NULL; char *errorMessage = NULL; char *schemasLocation = NULL; @@ -2418,6 +2438,18 @@ int msWCSException20(mapObj *map, const char *exceptionCode, xmlDocSetRootElement(psDoc, psRootNode); + if(EQUAL(exceptionCode, "OperationNotSupported") + || EQUAL(exceptionCode, "OptionNotSupported")) { + status = "501 Not Implemented"; + } + else if (EQUAL(exceptionCode, "NoSuchCoverage") + || EQUAL(exceptionCode, "emptyCoverageIdList") + || EQUAL(exceptionCode, "InvalidAxisLabel") + || EQUAL(exceptionCode, "InvalidSubsetting")) { + status = "404 Not Found"; + } + + msIO_setHeader("Status", status); if (encoding) msIO_setHeader("Content-Type","text/xml; charset=%s", encoding); else @@ -2958,29 +2990,10 @@ int msWCSDescribeCoverage20(mapObj *map, wcs20ParamsObjPtr params, owsRequestObj /* is found out. */ /************************************************************************/ -static int msWCSGetCoverage20_FinalizeParamsObj(wcs20ParamsObjPtr params) +static int msWCSGetCoverage20_FinalizeParamsObj(wcs20ParamsObjPtr params, wcs20AxisObjPtr *axes) { - int returnValue; - static const int numAxis = 2; - char *validXAxisNames[] = {"x", "xaxis", "x-axis", "x_axis", "long", "long_axis", "long-axis", "lon", "lon_axis", "lon-axis", NULL}; - char *validYAxisNames[] = {"y", "yaxis", "y-axis", "y_axis", "lat", "lat_axis", "lat-axis", NULL}; - char ***validAxisNames; char *crs = NULL; - wcs20AxisObjPtr *axes; - - axes = (wcs20AxisObjPtr*)msSmallMalloc(sizeof(wcs20AxisObjPtr) * numAxis); - - validAxisNames = msSmallCalloc(sizeof(char**), numAxis); - validAxisNames[0] = validXAxisNames; - validAxisNames[1] = validYAxisNames; - - returnValue = msWCSValidateAndFindAxes20(params, validAxisNames, numAxis, axes); - msFree(validAxisNames); - if(returnValue != MS_SUCCESS) { - msFree(axes); - return MS_FAILURE; - } - + if (axes[0] != NULL) { if(axes[0]->subset != NULL) { msDebug("Subset for X-axis found: %s\n", axes[0]->subset->axis); @@ -3008,7 +3021,6 @@ static int msWCSGetCoverage20_FinalizeParamsObj(wcs20ParamsObjPtr params) if(!EQUAL(crs, axes[1]->subset->crs)) { msSetError(MS_WCSERR, "CRS for axis %s and axis %s are not the same.", "msWCSCreateBoundingBox20()", axes[0]->name, axes[1]->name); - msFree(axes); return MS_FAILURE; } } else { @@ -3025,13 +3037,10 @@ static int msWCSGetCoverage20_FinalizeParamsObj(wcs20ParamsObjPtr params) msSetError(MS_WCSERR, "The units of measure of the resolution for" "axis %s and axis %s are not the same.", "msWCSCreateBoundingBox20()", axes[0]->name, axes[1]->name); - msFree(axes); return MS_FAILURE; } } - msFree(axes); - /* check if projections are equal */ if(crs != NULL) { params->subsetcrs = msStrdup(crs); @@ -3168,9 +3177,9 @@ int msWCSGetCoverage20(mapObj *map, cgiRequestObj *request, /* throw exception if no Layer was found */ if (layer == NULL) { msSetError(MS_WCSERR, - "COVERAGE=%s not found, not in supported layer list. A layer might be disabled for \ + "COVERAGEID=%s not found, not in supported layer list. A layer might be disabled for \ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", params->ids[0]); - return msWCSException(map, "InvalidParameterValue", "coverage", + return msWCSException(map, "NoSuchCoverage", "coverageid", params->version); } /* retrieve coverage metadata */ @@ -3204,9 +3213,20 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p "projection", params->version); } - if(msWCSGetCoverage20_FinalizeParamsObj(params) == MS_FAILURE) { - msWCSClearCoverageMetadata20(&cm); - return msWCSException(map, "InvalidParameterValue", "extent", params->version); + { + wcs20AxisObjPtr *axes; + axes = msSmallMalloc(sizeof(wcs20AxisObjPtr) * 2); + if(msWCSValidateAndFindAxes20(params, axes) == MS_FAILURE) { + msWCSClearCoverageMetadata20(&cm); + msFree(axes); + return msWCSException(map, "InvalidAxisLabel", "subset", params->version); + } + if(msWCSGetCoverage20_FinalizeParamsObj(params, axes) == MS_FAILURE) { + msWCSClearCoverageMetadata20(&cm); + msFree(axes); + return msWCSException(map, "InvalidParameterValue", "extent", params->version); + } + msFree(axes); } subsets = params->bbox; From 8c16d516af55b69ded6727daa30d65b14b88a1f9 Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Wed, 7 Aug 2013 14:40:07 +0200 Subject: [PATCH 20/28] Fixing typo. --- mapwcs20.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mapwcs20.c b/mapwcs20.c index 6e49598888..ddb6f1d1b4 100644 --- a/mapwcs20.c +++ b/mapwcs20.c @@ -697,7 +697,7 @@ static int msWCSParseRequest20_XMLGetCoverage( params->multipart = MS_TRUE; } else { - msSetError(MS_WCSERR, "Invalid value '%s' for parameter 'Mediatype'." + msSetError(MS_WCSERR, "Invalid value '%s' for parameter 'Mediatype'.", "msWCSParseRequest20()", content); xmlFree(content); return MS_FAILURE; @@ -990,7 +990,7 @@ int msWCSParseRequest20(mapObj *map, params->multipart = MS_TRUE; } else { - msSetError(MS_WCSERR, "Invalid value '%s' for parameter 'Mediatype'." + msSetError(MS_WCSERR, "Invalid value '%s' for parameter 'Mediatype'.", "msWCSParseRequest20()", value); return MS_FAILURE; } From ddc8d510ec92fae146b0e7c1435610126a17e41d Mon Sep 17 00:00:00 2001 From: Stephan Meissl Date: Wed, 7 Aug 2013 14:55:10 +0200 Subject: [PATCH 21/28] Updating msautotest submodule. --- msautotest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msautotest b/msautotest index 4d7002c68e..4e18006210 160000 --- a/msautotest +++ b/msautotest @@ -1 +1 @@ -Subproject commit 4d7002c68e63ab683ebdd02b68e37805cf07b320 +Subproject commit 4e180062102dc21bf217f2692fedb683b2b3db64 From a592467489990eaf0b44401019c2f30642b39c0c Mon Sep 17 00:00:00 2001 From: Alan Boudreault Date: Wed, 7 Aug 2013 14:17:49 +0000 Subject: [PATCH 22/28] Fix some warnings --- mapserver.h | 1 + mapuvraster.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mapserver.h b/mapserver.h index 9987a33743..aec2d0abed 100644 --- a/mapserver.h +++ b/mapserver.h @@ -2041,6 +2041,7 @@ extern "C" { MS_DLL_EXPORT int msLoadSymbolSet(symbolSetObj *symbolset, mapObj *map); MS_DLL_EXPORT int msCopySymbol(symbolObj *dst, symbolObj *src, mapObj *map); MS_DLL_EXPORT int msCopySymbolSet(symbolSetObj *dst, symbolSetObj *src, mapObj *map); + MS_DLL_EXPORT int msCopyHashTable(hashTableObj *dst, hashTableObj *src); MS_DLL_EXPORT void msInitSymbolSet(symbolSetObj *symbolset); MS_DLL_EXPORT symbolObj *msGrowSymbolSet( symbolSetObj *symbolset ); MS_DLL_EXPORT int msAddImageSymbol(symbolSetObj *symbolset, char *filename); diff --git a/mapuvraster.c b/mapuvraster.c index 296b41d011..3cc1e282dd 100644 --- a/mapuvraster.c +++ b/mapuvraster.c @@ -404,7 +404,7 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) outputformat->imagemode = MS_IMAGEMODE_FLOAT32; msAppendOutputFormat(map_tmp, outputformat); - msCopyHashTable(map_tmp->configoptions, layer->map->configoptions); + msCopyHashTable(&map_tmp->configoptions, &layer->map->configoptions); map_tmp->mappath = msStrdup(layer->map->mappath); map_tmp->shapepath = msStrdup(layer->map->shapepath); map_tmp->extent.minx = rect.minx-(0.5*map_cellsize)+(0.5*map_tmp->cellsize); @@ -416,7 +416,7 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) msCopyProjection(&map_tmp->projection, &layer->projection); if (layer->debug == 5) - msDebug("msUVRASTERLayerWhichShapes(): extent: %g %d %g %g\n", + msDebug("msUVRASTERLayerWhichShapes(): extent: %g %g %g %g\n", map_tmp->extent.minx, map_tmp->extent.miny, map_tmp->extent.maxx, map_tmp->extent.maxy); @@ -447,7 +447,7 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) } if (msDrawRasterLayerLow(map_tmp, layer, image_tmp, NULL ) == MS_FAILURE) { - msSetError(MS_MISCERR, "Unable to draw raster data.", NULL, "msUVRASTERLayerWhichShapes()" ); + msSetError(MS_MISCERR, "Unable to draw raster data.", "msUVRASTERLayerWhichShapes()"); return MS_FAILURE; } From bd4693a7f77da02d01b3c4a4be523d2c3175a3b0 Mon Sep 17 00:00:00 2001 From: Stephan Meissl Date: Wed, 7 Aug 2013 17:05:50 +0200 Subject: [PATCH 23/28] Adjusting exceptionCode in WCS 2.0. --- mapwcs20.c | 2 +- msautotest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mapwcs20.c b/mapwcs20.c index ddb6f1d1b4..b33c23a39f 100644 --- a/mapwcs20.c +++ b/mapwcs20.c @@ -1071,7 +1071,7 @@ int msWCSParseRequest20(mapObj *map, msSetError(MS_WCSERR, "The axis '%s' is already subsetted.", "msWCSParseRequest20()", axis->name); msWCSFreeSubsetObj20(subset); - msWCSException(map, "InvalidSubsetting", "subset", ows_request->version); + msWCSException(map, "InvalidAxisLabel", "subset", ows_request->version); return MS_DONE; } axis->subset = subset; diff --git a/msautotest b/msautotest index 4e18006210..36caa6c2ca 160000 --- a/msautotest +++ b/msautotest @@ -1 +1 @@ -Subproject commit 4e180062102dc21bf217f2692fedb683b2b3db64 +Subproject commit 36caa6c2ca0616cc6e76f5da989b58028f00ec26 From 04a51b4bba3cd4c51e20cc4548dce7433db0e0e2 Mon Sep 17 00:00:00 2001 From: Stephan Meissl Date: Thu, 8 Aug 2013 10:06:13 +0200 Subject: [PATCH 24/28] Resolving previously introduced warning. --- mapwcs20.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mapwcs20.c b/mapwcs20.c index b33c23a39f..ce97116bd1 100644 --- a/mapwcs20.c +++ b/mapwcs20.c @@ -2449,7 +2449,7 @@ int msWCSException20(mapObj *map, const char *exceptionCode, status = "404 Not Found"; } - msIO_setHeader("Status", status); + msIO_setHeader("Status", "%s", status); if (encoding) msIO_setHeader("Content-Type","text/xml; charset=%s", encoding); else From d3ec34402591526f2828bc93b1d484ec06ffa472 Mon Sep 17 00:00:00 2001 From: Thomas Bonfort Date: Tue, 13 Aug 2013 11:23:26 +0200 Subject: [PATCH 25/28] Fix NULL type shp creation in tile4ms (#4259) closes #4259 --- tile4ms.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tile4ms.c b/tile4ms.c index 445acedda3..266bf3b237 100644 --- a/tile4ms.c +++ b/tile4ms.c @@ -213,6 +213,7 @@ int process_shapefiles(char *metaFileNameP, char *tileFileNameP, /* create and add shape object. Returns link to entry in DBF file */ /* --------------------------------------------------------------- */ + shapeRect.type = MS_SHAPE_POLYGON; msAddLine(&shapeRect, &line); entityNum = msSHPWriteShape( tileSHP, &shapeRect ); From 36e2f744cd4c0283c95d1382090ed1a30a6dae6e Mon Sep 17 00:00:00 2001 From: Stephan Meissl Date: Sun, 18 Aug 2013 12:19:57 +0200 Subject: [PATCH 26/28] Adjust exceptionCode in WCS 2.0 (#4735). --- mapwcs20.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/mapwcs20.c b/mapwcs20.c index ce97116bd1..f03681ba31 100644 --- a/mapwcs20.c +++ b/mapwcs20.c @@ -1120,20 +1120,6 @@ static int msWCSValidateAndFindAxes20( for(iParamAxis = 0; iParamAxis < params->numaxes; ++iParamAxis) { int found = 0; - /* check if subset is valid */ - if(params->axes[iParamAxis]->subset != NULL) { - if(params->axes[iParamAxis]->subset->timeOrScalar == MS_WCS20_TIME_VALUE) { - msSetError(MS_WCSERR, "Time values for subsets are not supported. ", - "msWCSValidateAndFindAxes20()"); - return MS_FAILURE; - } - if(params->axes[iParamAxis]->subset->operation == MS_WCS20_SLICE) { - msSetError(MS_WCSERR, "Subset operation 'slice' is not supported.", - "msWCSValidateAndFindAxes20()"); - return MS_FAILURE; - } - } - /* iterate over all given axes */ for(iAcceptedAxis = 0; iAcceptedAxis < numAxis; ++iAcceptedAxis ) { /* iterate over all possible names for the current axis */ @@ -3213,6 +3199,22 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p "projection", params->version); } + /* iterate over all subsets and check if they are valid*/ + for(i = 0; i < params->numaxes; ++i) { + if(params->axes[i]->subset != NULL) { + if(params->axes[i]->subset->timeOrScalar == MS_WCS20_TIME_VALUE) { + msSetError(MS_WCSERR, "Time values for subsets are not supported. ", + "msWCSGetCoverage20()"); + return msWCSException(map, "InvalidSubsetting", "subset", params->version); + } + if(params->axes[i]->subset->operation == MS_WCS20_SLICE) { + msSetError(MS_WCSERR, "Subset operation 'slice' is not supported.", + "msWCSGetCoverage20()"); + return msWCSException(map, "InvalidSubsetting", "subset", params->version); + } + } + } + { wcs20AxisObjPtr *axes; axes = msSmallMalloc(sizeof(wcs20AxisObjPtr) * 2); From 5a71ab350d15261d7636a769e62bbfe7b5039638 Mon Sep 17 00:00:00 2001 From: Stephan Meissl Date: Sun, 18 Aug 2013 12:30:45 +0200 Subject: [PATCH 27/28] Update msautotest submodule. --- msautotest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msautotest b/msautotest index 36caa6c2ca..4fab671cc4 160000 --- a/msautotest +++ b/msautotest @@ -1 +1 @@ -Subproject commit 36caa6c2ca0616cc6e76f5da989b58028f00ec26 +Subproject commit 4fab671cc435ec9b5374a95f707928cba2bfd683 From c4a70d763c95e7e607bdcd1fa7045c88e4620e14 Mon Sep 17 00:00:00 2001 From: szekerest Date: Wed, 21 Aug 2013 11:59:42 +0200 Subject: [PATCH 28/28] align parameter not saved (#3057) --- mapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mapfile.c b/mapfile.c index 918db02ba8..2f01a52e44 100644 --- a/mapfile.c +++ b/mapfile.c @@ -2139,7 +2139,7 @@ static void writeLabel(FILE *stream, int indent, labelObj *label) else writeNumber(stream, indent, "SIZE", -1, label->size); } - writeKeyword(stream, indent, "ALIGN", label->align, MS_ALIGN_CENTER, "CENTER", MS_ALIGN_RIGHT, "RIGHT"); + writeKeyword(stream, indent, "ALIGN", label->align, 2, MS_ALIGN_CENTER, "CENTER", MS_ALIGN_RIGHT, "RIGHT"); writeNumber(stream, indent, "BUFFER", 0, label->buffer); if(label->numbindings > 0 && label->bindings[MS_LABEL_BINDING_COLOR].item)