diff options
author | unknown <gkodinov/kgeorge@magare.gmz> | 2008-03-28 10:41:52 +0200 |
---|---|---|
committer | unknown <gkodinov/kgeorge@magare.gmz> | 2008-03-28 10:41:52 +0200 |
commit | 1c734848abd3739d2021138cd74002696b1f9e3c (patch) | |
tree | aff9a153698fcfbb202ced06d596144ce1bfbb4c /sql/sql_connect.cc | |
parent | 099c888967557c164e11cb0ca7d895898be6edc9 (diff) | |
parent | c1af64e04f25a8dc01861c161b80be328de8f7d3 (diff) | |
download | mariadb-git-1c734848abd3739d2021138cd74002696b1f9e3c.tar.gz |
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1
into magare.gmz:/home/kgeorge/mysql/work/merge-5.1-bugteam
mysql-test/r/grant.result:
Auto merged
mysql-test/t/grant.test:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_connect.cc:
Auto merged
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r-- | sql/sql_connect.cc | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 6f8cd6494cd..d9fb586eb77 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -701,20 +701,24 @@ static int check_connection(THD *thd) bzero((char*) &thd->remote, sizeof(thd->remote)); } vio_keepalive(net->vio, TRUE); + + ulong server_capabilites; { /* buff[] needs to big enough to hold the server_version variable */ char buff[SERVER_VERSION_LENGTH + SCRAMBLE_LENGTH + 64]; - ulong client_flags = (CLIENT_LONG_FLAG | CLIENT_CONNECT_WITH_DB | - CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION); + server_capabilites= CLIENT_BASIC_FLAGS; if (opt_using_transactions) - client_flags|=CLIENT_TRANSACTIONS; + server_capabilites|= CLIENT_TRANSACTIONS; #ifdef HAVE_COMPRESS - client_flags |= CLIENT_COMPRESS; + server_capabilites|= CLIENT_COMPRESS; #endif /* HAVE_COMPRESS */ #ifdef HAVE_OPENSSL if (ssl_acceptor_fd) - client_flags |= CLIENT_SSL; /* Wow, SSL is available! */ + { + server_capabilites |= CLIENT_SSL; /* Wow, SSL is available! */ + server_capabilites |= CLIENT_SSL_VERIFY_SERVER_CERT; + } #endif /* HAVE_OPENSSL */ end= strnmov(buff, server_version, SERVER_VERSION_LENGTH) + 1; @@ -733,7 +737,7 @@ static int check_connection(THD *thd) */ end= strmake(end, thd->scramble, SCRAMBLE_LENGTH_323) + 1; - int2store(end, client_flags); + int2store(end, server_capabilites); /* write server characteristics: up to 16 bytes allowed */ end[2]=(char) default_charset_info->number; int2store(end+3, thd->server_status); @@ -763,7 +767,7 @@ static int check_connection(THD *thd) if (thd->packet.alloc(thd->variables.net_buffer_length)) return 1; /* The error is set by alloc(). */ - thd->client_capabilities=uint2korr(net->read_pos); + thd->client_capabilities= uint2korr(net->read_pos); if (thd->client_capabilities & CLIENT_PROTOCOL_41) { thd->client_capabilities|= ((ulong) uint2korr(net->read_pos+2)) << 16; @@ -778,6 +782,11 @@ static int check_connection(THD *thd) thd->max_client_packet_length= uint3korr(net->read_pos+2); end= (char*) net->read_pos+5; } + /* + Disable those bits which are not supported by the server. + This is a precautionary measure, if the client lies. See Bug#27944. + */ + thd->client_capabilities&= server_capabilites; if (thd->client_capabilities & CLIENT_IGNORE_SPACE) thd->variables.sql_mode|= MODE_IGNORE_SPACE; |