[mapserver-commits] r9794 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Feb 16 11:52:46 EST 2010


Author: assefa
Date: 2010-02-16 11:52:45 -0500 (Tue, 16 Feb 2010)
New Revision: 9794

Modified:
   trunk/mapserver/mapwfs.c
Log:
Invalid attribute given as a propertyname should return an exception #3318

Modified: trunk/mapserver/mapwfs.c
===================================================================
--- trunk/mapserver/mapwfs.c	2010-02-16 14:39:29 UTC (rev 9793)
+++ trunk/mapserver/mapwfs.c	2010-02-16 16:52:45 UTC (rev 9794)
@@ -1068,7 +1068,7 @@
   }
 
   if(paramsObj->pszTypeName) {
-    int j, k, z;
+      int j, k, y,z;
     
     char **tokens;
     int n=0, i=0;
@@ -1234,6 +1234,29 @@
                         papszPropertyName[k] = msReplaceSubstring(papszPropertyName[k], pszFullName, lp->items[z]);
                   
                   }
+
+                  /*validate that the property names passed are part of the items list*/
+                  tokens = msStringSplit(papszPropertyName[k], ',', &n);
+                  for (y=0; y<n; y++)
+                  {
+                      if (tokens[y] && strlen(tokens[y]) > 0)
+                      {
+                          for(z=0; z<lp->numitems; z++) 
+                          {
+                              if (strcasecmp(tokens[y], lp->items[z]) == 0)
+                                break;
+                          }
+                          if (z == lp->numitems)
+                          {
+                              msSetError(MS_WFSERR, 
+                                         "Invalid PROPERTYNAME %s",  "msWFSGetFeature()", tokens[y]);
+                              msFreeCharArray(tokens, n);
+                              return msWFSException(map, "PROPERTYNAME", "InvalidParameterValue", paramsObj->pszVersion);
+                          }
+                      }
+                  }
+                  if (tokens && n > 0)
+                    msFreeCharArray(tokens, n);
                   msLayerClose(lp);
               } 
                       



More information about the mapserver-commits mailing list