Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71a185a

Browse files
author
Michael Meskes
committed
ECPG connect routine only checked for NULL to find empty parameters, but user and password can also be "".
1 parent cd86869 commit 71a185a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/interfaces/ecpg/ecpglib/connect.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.54 2009/06/11 14:49:13 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.55 2010/05/07 19:35:03 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -475,7 +475,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
475475
host ? host : "<DEFAULT>",
476476
port ? (ecpg_internal_regression_mode ? "<REGRESSION_PORT>" : port) : "<DEFAULT>",
477477
options ? "with options " : "", options ? options : "",
478-
user ? "for user " : "", user ? user : "");
478+
(user && strlen(user) > 0) ? "for user " : "", user ? user : "");
479479

480480
connect_string = ecpg_alloc(strlen_or_null(host)
481481
+ strlen_or_null(port)
@@ -494,8 +494,8 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
494494
realname ? "dbname=" : "", realname ? realname : "",
495495
host ? "host=" : "", host ? host : "",
496496
port ? "port=" : "", port ? port : "",
497-
user ? "user=" : "", user ? user : "",
498-
passwd ? "password=" : "", passwd ? passwd : "",
497+
(user && strlen(user) > 0) ? "user=" : "", user ? user : "",
498+
(passwd && strlen(passwd) > 0) ? "password=" : "", passwd ? passwd : "",
499499
options ? options : "");
500500

501501
/*

0 commit comments

Comments
 (0)