Skip to content

Commit 929b3a7

Browse files
committed
BUG30270760: Fix reserved filed should have a length of 22
When fixing BUG29855733, which resolves the error during connection using charset and collation combination, the reserved filed was not updated to 22. Tests were added for regression.
1 parent 70ee8dc commit 929b3a7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/mysql/connector/protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -141,7 +141,7 @@ def make_auth_ssl(self, charset=45, client_flags=0,
141141
return utils.int4store(client_flags) + \
142142
utils.int4store(max_allowed_packet) + \
143143
utils.int2store(charset) + \
144-
b'\x00' * 23
144+
b'\x00' * 22
145145

146146
def make_command(self, command, argument=None):
147147
"""Make a MySQL packet containing a command"""

tests/test_protocol.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,20 @@ def test_make_auth_ssl(self):
139139
({},
140140
b'\x00\x00\x00\x00\x00\x00\x00@-\x00\x00\x00\x00\x00\x00'
141141
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
142-
b'\x00\x00\x00\x00'),
142+
b'\x00\x00\x00'),
143143
({'charset': 8},
144144
b'\x00\x00\x00\x00\x00\x00\x00@\x08\x00\x00\x00\x00\x00\x00'
145145
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
146-
b'\x00\x00\x00\x00'),
146+
b'\x00\x00\x00'),
147147
({'client_flags': 240141},
148148
b'\r\xaa\x03\x00\x00\x00\x00@-\x00\x00\x00\x00\x00\x00\x00'
149149
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
150-
b'\x00\x00\x00'),
150+
b'\x00\x00'),
151151
({'charset': 8, 'client_flags': 240141,
152152
'max_allowed_packet': 2147483648},
153153
b'\r\xaa\x03\x00\x00\x00\x00\x80\x08\x00\x00\x00\x00\x00'
154154
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
155-
b'\x00\x00\x00\x00\x00'),
155+
b'\x00\x00\x00\x00'),
156156
]
157157
for kwargs, exp in cases:
158158
self.assertEqual(exp, self._protocol.make_auth_ssl(**kwargs))

0 commit comments

Comments
 (0)