summaryrefslogtreecommitdiff
path: root/sql/sql_connect.cc
diff options
context:
space:
mode:
authorKaren Langford <karen.langford@oracle.com>2011-07-01 16:15:50 +0200
committerKaren Langford <karen.langford@oracle.com>2011-07-01 16:15:50 +0200
commit1660a3cbf676074a74f5df9862c87cb9136ce231 (patch)
tree03e69a82786000fa9381add5e51142ee869ad03c /sql/sql_connect.cc
parent1dcd90b80b105422052a130937131f149d61e583 (diff)
downloadmariadb-git-1660a3cbf676074a74f5df9862c87cb9136ce231.tar.gz
Patch to fix SS #12698716 : Java/ConnectorJ regression problem
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r--sql/sql_connect.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index a019c653cfc..51608718349 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -22,6 +22,7 @@
/** Size of the header fields of an authentication packet. */
#define AUTH_PACKET_HEADER_SIZE_PROTO_41 32
#define AUTH_PACKET_HEADER_SIZE_PROTO_40 5
+#define AUTH_PACKET_HEADER_SIZE_CONNJ_SSL 4
#ifdef __WIN__
extern void win_install_sigabrt_handler();
@@ -955,6 +956,23 @@ static int check_connection(THD *thd)
thd->client_capabilities= uint2korr(end);
+ /*
+ JConnector only sends client capabilities (4 bytes) before starting SSL
+ negotiation so we don't have char_set and other information for client in
+ packet read. In that case, skip reading those information. The below code
+ is patch for this.
+ */
+ if(bytes_remaining_in_packet == AUTH_PACKET_HEADER_SIZE_CONNJ_SSL &&
+ thd->client_capabilities & CLIENT_SSL)
+ {
+ thd->client_capabilities= uint4korr(end);
+ thd->max_client_packet_length= 0xfffff;
+ charset_code= default_charset_info->number;
+ end+= AUTH_PACKET_HEADER_SIZE_CONNJ_SSL;
+ bytes_remaining_in_packet-= AUTH_PACKET_HEADER_SIZE_CONNJ_SSL;
+ goto skip_to_ssl;
+ }
+
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
packet_has_required_size= bytes_remaining_in_packet >=
AUTH_PACKET_HEADER_SIZE_PROTO_41;
@@ -989,6 +1007,8 @@ static int check_connection(THD *thd)
charset_code= default_charset_info->number;
}
+skip_to_ssl:
+
DBUG_PRINT("info", ("client_character_set: %u", charset_code));
if (thd_init_client_charset(thd, charset_code))
goto error;