From: Heikki Linnakangas Date: Thu, 6 Apr 2017 14:41:48 +0000 (+0300) Subject: Remove bogus SCRAM_ITERATION_LEN constant. X-Git-Tag: REL_10_BETA1~368 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=07044efe00762bdd04c4d392adb8f6425b13369b;p=postgresql Remove bogus SCRAM_ITERATION_LEN constant. It was not used for what the comment claimed, at all. It was actually used as the 'base' argument to strtol(), when reading the iteration count. We don't need a constant for base-10, so remove it. --- diff --git a/src/backend/libpq/auth-scram.c b/src/backend/libpq/auth-scram.c index bcc8d03ef5..14ddc8bd54 100644 --- a/src/backend/libpq/auth-scram.c +++ b/src/backend/libpq/auth-scram.c @@ -476,7 +476,7 @@ parse_scram_verifier(const char *verifier, char **salt, int *iterations, if ((p = strtok(NULL, ":")) == NULL) goto invalid_verifier; errno = 0; - *iterations = strtol(p, &p, SCRAM_ITERATION_LEN); + *iterations = strtol(p, &p, 10); if (*p || errno != 0) goto invalid_verifier; diff --git a/src/include/common/scram-common.h b/src/include/common/scram-common.h index 7c98cc74d6..6740069eee 100644 --- a/src/include/common/scram-common.h +++ b/src/include/common/scram-common.h @@ -31,9 +31,6 @@ /* length of salt when generating new verifiers */ #define SCRAM_SALT_LEN 10 -/* number of bytes used when sending iteration number during exchange */ -#define SCRAM_ITERATION_LEN 10 - /* default number of iterations when generating verifier */ #define SCRAM_ITERATIONS_DEFAULT 4096 diff --git a/src/interfaces/libpq/fe-auth-scram.c b/src/interfaces/libpq/fe-auth-scram.c index a7bb30a141..818ade4993 100644 --- a/src/interfaces/libpq/fe-auth-scram.c +++ b/src/interfaces/libpq/fe-auth-scram.c @@ -444,7 +444,7 @@ read_server_first_message(fe_scram_state *state, char *input, /* read_attr_value() has generated an error string */ return false; } - state->iterations = strtol(iterations_str, &endptr, SCRAM_ITERATION_LEN); + state->iterations = strtol(iterations_str, &endptr, 10); if (*endptr != '\0' || state->iterations < 1) { printfPQExpBuffer(errormessage,