]> granicus.if.org Git - postgresql/commitdiff
Remove bogus SCRAM_ITERATION_LEN constant.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 6 Apr 2017 14:41:48 +0000 (17:41 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 6 Apr 2017 14:41:48 +0000 (17:41 +0300)
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.

src/backend/libpq/auth-scram.c
src/include/common/scram-common.h
src/interfaces/libpq/fe-auth-scram.c

index bcc8d03ef59100d032787e0b0bc6e65571c1f8ef..14ddc8bd5425529a4585b457caf7628e0c05f54f 100644 (file)
@@ -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;
 
index 7c98cc74d67b8f054169896660a703b48545f83a..6740069eee18368715748600c18a07dcddc19060 100644 (file)
@@ -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
 
index a7bb30a141c5317138f9d632a620272a98b3045d..818ade4993aaad67e0be95ad83cdd114a70a1c00 100644 (file)
@@ -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,