diff --git a/src/common/scram-common.c b/src/common/scram-common.c index ef997ef6849..6448564a08c 100644 --- a/src/common/scram-common.c +++ b/src/common/scram-common.c @@ -22,6 +22,9 @@ #include "common/base64.h" #include "common/hmac.h" #include "common/scram-common.h" +#ifndef FRONTEND +#include "miscadmin.h" +#endif #include "port/pg_bswap.h" /* @@ -73,6 +76,14 @@ scram_SaltedPassword(const char *password, /* Subsequent iterations */ for (i = 2; i <= iterations; i++) { +#ifndef FRONTEND + /* + * Make sure that this is interruptible as scram_iterations could be + * set to a large value. + */ + CHECK_FOR_INTERRUPTS(); +#endif + if (pg_hmac_init(hmac_ctx, (uint8 *) password, password_len) < 0 || pg_hmac_update(hmac_ctx, (uint8 *) Ui_prev, key_length) < 0 || pg_hmac_final(hmac_ctx, Ui, key_length) < 0)