From 24f7d91c1526c62f96a5fd9556b087d97ccdfad9 Mon Sep 17 00:00:00 2001 From: Yaroslav Panichkin Date: Sun, 23 Apr 2023 11:30:46 +0300 Subject: [PATCH] fix: salt and iterations parsing for scram --- asyncpg/protocol/scram.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asyncpg/protocol/scram.pyx b/asyncpg/protocol/scram.pyx index 765ddd46..9b485aee 100644 --- a/asyncpg/protocol/scram.pyx +++ b/asyncpg/protocol/scram.pyx @@ -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")