diff options
author | Andrey Hristov <andrey@php.net> | 2010-03-26 16:58:25 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2010-03-26 16:58:25 +0000 |
commit | 7868bca437431f95f4b51afa3e4c4b64e45ebad9 (patch) | |
tree | 74522e929e144647f36110a6036be47843d46ca1 /ext/mysqlnd/mysqlnd.c | |
parent | a2edb7f69c30fbc2cee6f0a4af94226b198ec558 (diff) | |
download | php-git-7868bca437431f95f4b51afa3e4c4b64e45ebad9.tar.gz |
Fix tests that fail when the MySQL's socket file is not /tmp/mysql.sock
as it is in when compiled from source and the default for mysqlnd.
SuSE for example uses /var/run/mysql/mysql.sock . Also, sql.safe_mode
(ext/mysql and ingres) needs the socket.
Fix possible crashes in mysqlnd. When packets are shorter, functions should
return error.
Diffstat (limited to 'ext/mysqlnd/mysqlnd.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 3a31a1d7e6..4f89b8c57e 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -516,20 +516,24 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MYSQLND *conn, if (!host || !host[0]) { host = "localhost"; } - if (!user || !user[0]) { - user = php_get_current_user(); + if (!user) { + DBG_INF_FMT("no user given, using empty string"); + user = ""; } if (!passwd) { + DBG_INF_FMT("no password given, using empty string"); passwd = ""; passwd_len = 0; } if (!db) { + DBG_INF_FMT("no db given, using empty string"); db = ""; db_len = 0; } host_len = strlen(host); #ifndef PHP_WIN32 if (host_len == sizeof("localhost") - 1 && !strncasecmp(host, "localhost", host_len)) { + DBG_INF_FMT("socket=%s", socket? socket:"n/a"); if (!socket) { socket = "/tmp/mysql.sock"; } |