Skip to content

Commit d5da745

Browse files
committed
Updated to support newest PyMySQL
1 parent da37273 commit d5da745

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

aiomysql/connection.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
ProgrammingError)
2727

2828
from pymysql.connections import TEXT_TYPES, MAX_PACKET_LEN, DEFAULT_CHARSET
29-
# from pymysql.connections import dump_packet
30-
from pymysql.connections import _scramble
31-
from pymysql.connections import _scramble_323
29+
from pymysql.connections import _auth
30+
3231
from pymysql.connections import pack_int24
3332

3433
from pymysql.connections import MysqlPacket
@@ -687,7 +686,7 @@ async def _request_authentication(self):
687686
auth_plugin = self._server_auth_plugin
688687

689688
if auth_plugin in ('', 'mysql_native_password'):
690-
authresp = _scramble(self._password.encode('latin1'), self.salt)
689+
authresp = _auth.scramble_native_password(self._password, self.salt)
691690
elif auth_plugin in ('', 'mysql_clear_password'):
692691
authresp = self._password.encode('latin1') + b'\0'
693692

@@ -731,8 +730,7 @@ async def _request_authentication(self):
731730
plugin_name, auth_packet)
732731
else:
733732
# send legacy handshake
734-
data = _scramble_323(self._password.encode('latin1'),
735-
self.salt) + b'\0'
733+
data = _auth.scramble_old_password(self._password, auth_packet.read_all()) + b'\0'
736734
self.write_packet(data)
737735
auth_packet = await self._read_packet()
738736

@@ -741,13 +739,11 @@ async def _process_auth(self, plugin_name, auth_packet):
741739
# https://dev.mysql.com/doc/internals/en/
742740
# secure-password-authentication.html#packet-Authentication::
743741
# Native41
744-
data = _scramble(self._password.encode('latin1'),
745-
auth_packet.read_all())
742+
data = _auth.scramble_native_password(self._password, auth_packet.read_all())
746743
elif plugin_name == b"mysql_old_password":
747744
# https://dev.mysql.com/doc/internals/en/
748745
# old-password-authentication.html
749-
data = _scramble_323(self._password.encode('latin1'),
750-
auth_packet.read_all()) + b'\0'
746+
data = _auth.scramble_old_password(self._password, auth_packet.read_all()) + b'\0'
751747
elif plugin_name == b"mysql_clear_password":
752748
# https://dev.mysql.com/doc/internals/en/
753749
# clear-text-authentication.html

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ipython==6.4.0
55
pytest==3.6.1
66
pytest-cov==2.5.1
77
pytest-sugar==0.9.1
8-
PyMySQL>=0.7.5,<0.9
8+
PyMySQL>=0.9,<=0.9.2
99
docker==3.3.0
1010
sphinx==1.7.5
1111
sphinxcontrib-asyncio==0.2.0

0 commit comments

Comments
 (0)