8000 Add sha256 and chaching sha2 auth support by methane · Pull Request #682 · PyMySQL/PyMySQL · GitHub
[go: up one dir, main page]

Skip to content

Add sha256 and chaching sha2 auth support #682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bugfix
  • Loading branch information
methane committed Jun 26, 2018
commit 6d993320daba46eb8c0b389c3a8d8d7221a1ae23
2 changes: 1 addition & 1 deletion pymysql/_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _xor_password(password, salt):
salt_len = len(salt)
for i in range(len(password_bytes)):
password_bytes[i] ^= salt[i % salt_len]
return password_bytes
return bytes(password_bytes)


def sha2_rsa_encrypt(password, salt, public_key):
Expand Down
4 changes: 2 additions & 2 deletions pymysql/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,9 +887,9 @@ def _process_auth(self, plugin_name, auth_packet):
raise err.OperationalError(2059, "Authentication plugin '%s'"
" not loaded: - %r missing authenticate method" % (plugin_name, type(handler)))
if plugin_name == b"caching_sha2_password":
data = _auth.caching_sha2_password_auth(self, auth_packet)
return _auth.caching_sha2_password_auth(self, auth_packet)
elif plugin_name == b"sha256_password":
data = _auth.sha256_password_auth(self, auth_packet)
return _auth.sha256_password_auth(self, auth_packet)
elif plugin_name == b"mysql_native_password":
data = _auth.scramble_native_password(self.password, auth_packet.read_all())
elif plugin_ 8000 name == b"mysql_old_password":
Expand Down
4 changes: 4 additions & 0 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

from pymysql._compat import PYPY, JYTHON, IRONPYTHON

#import pymysql
#pymysql.connections.DEBUG = True
#pymysql._auth.DEBUG = True

if not (PYPY or JYTHON or IRONPYTHON):
import atexit
import gc
Expand Down
0