[mapserver-commits] r7485 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Thu Mar 27 15:58:36 EDT 2008
Author: dmorissette
Date: 2008-03-27 15:58:36 -0400 (Thu, 27 Mar 2008)
New Revision: 7485
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mappostgis.c
Log:
Fixed handling of encrypted connection strings in postgis driver (#2563)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2008-03-27 19:55:36 UTC (rev 7484)
+++ trunk/mapserver/HISTORY.TXT 2008-03-27 19:58:36 UTC (rev 7485)
@@ -12,6 +12,9 @@
Current Version (5.1-dev, SVN trunk):
-------------------------------------
+
+- Fixed handling of encrypted connection strings in postgis driver (#2563)
+
- mapagg.cpp: AGG: add opacity at the style level (#1155)
- mapwms.c: add Cache-Control max-age HTTP header support (#2551)
Modified: trunk/mapserver/mappostgis.c
===================================================================
--- trunk/mapserver/mappostgis.c 2008-03-27 19:55:36 UTC (rev 7484)
+++ trunk/mapserver/mappostgis.c 2008-03-27 19:58:36 UTC (rev 7485)
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id:$
+ * $Id$
*
* Project: MapServer
* Purpose: PostGIS CONNECTIONTYPE support.
@@ -174,8 +174,6 @@
{
msPOSTGISLayerInfo *layerinfo;
int order_test = 1;
- char *index, *maskeddata;
- int i, count;
if(layer->debug) {
msDebug("msPOSTGISLayerOpen called datastatement: %s\n", layer->data);
@@ -224,21 +222,22 @@
return(MS_FAILURE); /* An error should already have been produced */
}
- layerinfo->conn = PQconnectdb(layer->connection);
+ layerinfo->conn = PQconnectdb(conn_decrypted);
msFree(conn_decrypted);
conn_decrypted = NULL;
if(!layerinfo->conn || PQstatus(layerinfo->conn) == CONNECTION_BAD) {
- msDebug("FAILURE!!!");
- maskeddata = (char *)malloc(strlen(layer->connection) + 1);
- strcpy(maskeddata, layer->connection);
+ char *index, *maskeddata;
+ if (layer->debug)
+ msDebug("msPOSTGISLayerOpen() FAILURE!!!\n");
+
+ maskeddata = strdup(layer->connection);
index = strstr(maskeddata, "password=");
if(index != NULL) {
index = (char *)(index + 9);
- count = (int)(strstr(index, " ") - index);
- for(i = 0; i < count; i++) {
- strncpy(index, "*", (int)1);
+ while(*index != '\0' && *index != ' ') {
+ *index = '*';
index++;
}
}
More information about the mapserver-commits
mailing list