[mapserver-commits] r9589 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Mon Dec 7 12:18:29 EST 2009
Author: aboudreault
Date: 2009-12-07 12:18:29 -0500 (Mon, 07 Dec 2009)
New Revision: 9589
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapcrypto.c
trunk/mapserver/mapjoin.c
trunk/mapserver/mappostgresql.c
Log:
Fixed joins do not accept crypted passwords (#2912)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2009-12-07 17:00:41 UTC (rev 9588)
+++ trunk/mapserver/HISTORY.TXT 2009-12-07 17:18:29 UTC (rev 9589)
@@ -14,6 +14,8 @@
Current Version (SVN trunk):
----------------------------
+- Fixed joins do not accept crypted passwords (#2912)
+
- Fixed HTML legend image samples truncated (#2636)
- WMS GetFeatureInfo should respect the scale like GetMap does (#842)
Modified: trunk/mapserver/mapcrypto.c
===================================================================
--- trunk/mapserver/mapcrypto.c 2009-12-07 17:00:41 UTC (rev 9588)
+++ trunk/mapserver/mapcrypto.c 2009-12-07 17:18:29 UTC (rev 9589)
@@ -487,9 +487,10 @@
pszTmp[pszEnd-pszStart] = '\0';
msDecryptStringWithKey(map->encryption_key, pszTmp, out);
-
+
out += strlen(out);
in = pszEnd+1;
+ free(pszTmp);
}
else
{
Modified: trunk/mapserver/mapjoin.c
===================================================================
--- trunk/mapserver/mapjoin.c 2009-12-07 17:00:41 UTC (rev 9588)
+++ trunk/mapserver/mapjoin.c 2009-12-07 17:18:29 UTC (rev 9589)
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id:$
+ * $Id$
*
* Project: MapServer
* Purpose: Implements MapServer joins.
@@ -549,6 +549,7 @@
#else
int i;
char qbuf[4000];
+ char *conn_decrypted;
msMySQLJoinInfo *joininfo;
MYDEBUG if (setvbuf(stdout, NULL, _IONBF , 0)){printf("Whoops...");};
@@ -576,11 +577,20 @@
return(MS_FAILURE);
}
+
+ conn_decrypted = msDecryptStringTokens(layer->map, join->connection);
+ if (conn_decrypted == NULL) {
+ msSetError(MS_QUERYERR, "Error parsing MYSQL JOIN: unable to decrypt CONNECTION statement.",
+ "msMySQLJoinConnect()");
+ return(MS_FAILURE);
+ }
+
delim = strdup(":");
- DB_HOST = strdup(strtok(join->connection, delim));
+ DB_HOST = strdup(strtok(conn_decrypted, delim));
DB_USER = strdup(strtok(NULL, delim));
DB_PASSWD = strdup(strtok(NULL, delim));
DB_DATABASE = strdup(strtok(NULL, delim));
+ free(conn_decrypted);
if (DB_HOST == NULL || DB_USER == NULL || DB_PASSWD == NULL || DB_DATABASE == NULL)
{
Modified: trunk/mapserver/mappostgresql.c
===================================================================
--- trunk/mapserver/mappostgresql.c 2009-12-07 17:00:41 UTC (rev 9588)
+++ trunk/mapserver/mappostgresql.c 2009-12-07 17:18:29 UTC (rev 9589)
@@ -74,6 +74,7 @@
int msPOSTGRESQLJoinConnect(layerObj *layer, joinObj *join) {
char *maskeddata, *temp, *sql, *column;
+ char *conn_decrypted;
int i, count, test;
PGresult *query_result;
msPOSTGRESQLJoinInfo *joininfo;
@@ -117,7 +118,11 @@
}
/* Establish database connection */
- joininfo->conn = PQconnectdb(join->connection);
+ conn_decrypted = msDecryptStringTokens(layer->map, join->connection);
+ if (conn_decrypted != NULL) {
+ joininfo->conn = PQconnectdb(conn_decrypted);
+ free(conn_decrypted);
+ }
if(!joininfo->conn || PQstatus(joininfo->conn) == CONNECTION_BAD) {
maskeddata = (char *)malloc(strlen(layer->connection) + 1);
strcpy(maskeddata, join->connection);
More information about the mapserver-commits
mailing list