[mapserver-commits] r11009 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Feb 24 23:53:48 EST 2011


Author: sdlime
Date: 2011-02-24 20:53:48 -0800 (Thu, 24 Feb 2011)
New Revision: 11009

Modified:
   trunk/mapserver/mapwcs20.c
Log:
Applied patch for #3686.

Modified: trunk/mapserver/mapwcs20.c
===================================================================
--- trunk/mapserver/mapwcs20.c	2011-02-25 04:51:51 UTC (rev 11008)
+++ trunk/mapserver/mapwcs20.c	2011-02-25 04:53:48 UTC (rev 11009)
@@ -151,6 +151,17 @@
 }
 
 /************************************************************************/
+/*                   msStringIsNCName()                                 */
+/*                                                                      */
+/*      Evaluates if a string is a valid NCName.                        */
+/************************************************************************/
+
+static int msStringIsNCName(char *string)
+{
+    return msEvalRegex("^[a-zA-z_][a-zA-Z0-9_.-]*$" , string);
+}
+
+/************************************************************************/
 /*                   msWCSCreateSubsetObj20()                           */
 /*                                                                      */
 /*      Creates a new wcs20SubsetObj and initializes it to standard     */
@@ -3707,6 +3718,24 @@
         return msWCSException(map, "InvalidParameterValue", "request", "2.0.0");
     }
 
+    /* check if all layer names are valid NCNames */
+    {
+        int i;
+        for(i = 0; i < map->numlayers; ++i)
+        {
+            if(!msWCSIsLayerSupported(map->layers[i]))
+                continue;
+
+            if(msStringIsNCName(map->layers[i]->name) == MS_FALSE)
+            {
+                msSetError(MS_WCSERR, "Layer name '%s' is not a valid NCName.",
+                        "msWCSDescribeCoverage20()", map->layers[i]->name);
+                msWCSFreeParamsObj20(params);
+                return msWCSException(map, "mapserv", "Internal", "2.0.0");
+            }
+        }
+    }
+
     /* Call operation specific functions */
     if (EQUAL(params->request, "GetCapabilities"))
     {



More information about the mapserver-commits mailing list