ECPG connect routine only checked for NULL to find empty parameters, but user and password can also be "".

This commit is contained in:
Michael Meskes 2010-05-07 19:35:03 +00:00
parent cd86869a9a
commit 71a185a24d

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.54 2009/06/11 14:49:13 momjian Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.55 2010/05/07 19:35:03 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@ -475,7 +475,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
host ? host : "<DEFAULT>",
port ? (ecpg_internal_regression_mode ? "<REGRESSION_PORT>" : port) : "<DEFAULT>",
options ? "with options " : "", options ? options : "",
user ? "for user " : "", user ? user : "");
(user && strlen(user) > 0) ? "for user " : "", user ? user : "");
connect_string = ecpg_alloc(strlen_or_null(host)
+ strlen_or_null(port)
@ -494,8 +494,8 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
realname ? "dbname=" : "", realname ? realname : "",
host ? "host=" : "", host ? host : "",
port ? "port=" : "", port ? port : "",
user ? "user=" : "", user ? user : "",
passwd ? "password=" : "", passwd ? passwd : "",
(user && strlen(user) > 0) ? "user=" : "", user ? user : "",
(passwd && strlen(passwd) > 0) ? "password=" : "", passwd ? passwd : "",
options ? options : "");
/*