]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Add CHECK_FOR_INTERRUPTS() in scram_SaltedPassword() for the backend
authorMichael Paquier <michael@paquier.xyz>
Mon, 27 Nov 2023 23:35:56 +0000 (08:35 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 27 Nov 2023 23:35:56 +0000 (08:35 +0900)
commit07cb7bc1c7a88299e6bce281320397f07ca045c2
treed7186fba5f3a63799a795945ea3b5b82cb83f734
parentbc22bd2575518cd69351c9fc2b459315a5858019
Add CHECK_FOR_INTERRUPTS() in scram_SaltedPassword() for the backend

scram_SaltedPassword() could take a long time to compute when the number
of iterations used is large enough, and this code uses a tight loop to
compute a salted password.

Note that the same issue exists in libpq when using \password and a
large iteration number, but this cannot be interrupted.  A CFI in the
backend is useful for server-side computations, at least.

Backpatch down to 16, where the user-settable GUC scram_iterations has
been added.

Author: Bowen Shi
Reviewed-by: Aleksander Alekseev, Daniel Gustafsson
Discussion: https://postgr.es/m/CAM_vCueV6xfr08KczfaCEk5J_qeTZtgqN7+orkNLx=g+phE82Q@mail.gmail.com
Backpatch-through: 16
src/common/scram-common.c