cvs: php4 /ext/dbx dbx_pgsql.c
| From: | Marc Boeren | Date: | Wed, 13 Feb 2002 11:09:48 +0000 |
| Subject: | cvs: php4 /ext/dbx dbx_pgsql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-9363@lists.php.net to get a copy of this message | ||
mboeren Wed Feb 13 06:09:48 2002 EDT
Modified files:
/php4/ext/dbx dbx_pgsql.c
Log:
Fixed bug where users with empty passwords could not connect. (Mc)
# thanks for testing, Yasuo. Could you commit the mem-leak patch now?
Index: php4/ext/dbx/dbx_pgsql.c
diff -u php4/ext/dbx/dbx_pgsql.c:1.15 php4/ext/dbx/dbx_pgsql.c:1.16
--- php4/ext/dbx/dbx_pgsql.c:1.15 Tue Dec 11 10:29:05 2001
+++ php4/ext/dbx/dbx_pgsql.c Wed Feb 13 06:09:48 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dbx_pgsql.c,v 1.15 2001/12/11 15:29:05 sebastian Exp $ */
+/* $Id: dbx_pgsql.c,v 1.16 2002/02/13 11:09:48 mboeren Exp $ */
#include "dbx.h"
#include "php_dbx.h"
@@ -38,13 +38,13 @@
MAKE_STD_ZVAL(conn_zval);
ZVAL_LONG(conn_zval, 0);
- if (Z_STRLEN_PP(username)>0 && Z_STRLEN_PP(password)>0) {
+ if (Z_STRLEN_PP(username)>0) {
int len;
len = Z_STRLEN_PP(host)+Z_STRLEN_PP(db)+strlen(port);
- len += Z_STRLEN_PP(username)+Z_STRLEN_PP(password)+35;
+ len += Z_STRLEN_PP(username)+Z_STRLEN_PP(password)+45;
connstring = (char *)emalloc(len+1);
- sprintf(connstring, "host=%s port=%s dbname=%s user=%s password=%s",
+ sprintf(connstring, "host='%s' port='%s' dbname='%s'
user='%s' password='%s'",
Z_STRVAL_PP(host), port, Z_STRVAL_PP(db),
Z_STRVAL_PP(username), Z_STRVAL_PP(password));
ZVAL_STRING(conn_zval, connstring, 1);
@@ -83,13 +83,13 @@
MAKE_STD_ZVAL(conn_zval);
ZVAL_LONG(conn_zval, 0);
- if (Z_STRLEN_PP(username)>0 && Z_STRLEN_PP(password)>0) {
+ if (Z_STRLEN_PP(username)>0) {
int len;
len = Z_STRLEN_PP(host)+Z_STRLEN_PP(db)+strlen(port);
- len += Z_STRLEN_PP(username)+Z_STRLEN_PP(password)+35;
+ len += Z_STRLEN_PP(username)+Z_STRLEN_PP(password)+45;
connstring = (char *)emalloc(len+1);
- sprintf(connstring, "host=%s port=%s dbname=%s user=%s password=%s",
+ sprintf(connstring, "host='%s' port='%s' dbname='%s'
user='%s' password='%s'",
Z_STRVAL_PP(host), port, Z_STRVAL_PP(db),
Z_STRVAL_PP(username), Z_STRVAL_PP(password));
ZVAL_STRING(conn_zval, connstring, 1);
@@ -139,7 +139,7 @@
or 0 as long on failure */
int nargs=2;
zval **args[2];
- zval *returned_zval=NULL, *num_rows_zval=NULL;
+ zval *returned_zval=NULL;
/* db_name is not used in this function */
args[0]=dbx_handle;