Skip to content

Commit

Permalink
fix: salt and iterations parsing for scram (#1026)
Browse files Browse the repository at this point in the history
Co-authored-by: Yaroslav Panichkin <panichkin.yak@phystech.edu>
  • Loading branch information
trigonometr and Yaroslav Panichkin committed May 8, 2023
1 parent 172b8f6 commit 7443a9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions asyncpg/protocol/scram.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ cdef class SCRAMAuthentication:
if not self.server_nonce.startswith(self.client_nonce):
raise Exception("invalid nonce")
try:
self.password_salt = re.search(b's=([^,]+),',
self.password_salt = re.search(b',s=([^,]+),',
self.server_first_message).group(1)
except IndexError:
raise Exception("could not get salt")
try:
self.password_iterations = int(re.search(b'i=(\d+),?',
self.password_iterations = int(re.search(b',i=(\d+),?',
self.server_first_message).group(1))
except (IndexError, TypeError, ValueError):
raise Exception("could not get iterations")
Expand Down

0 comments on commit 7443a9e

Please sign in to comment.