]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Make password_scheme_encryption_rounds extern to allow plugins to read it.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 1 Mar 2016 17:37:30 +0000 (19:37 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 1 Mar 2016 17:37:30 +0000 (19:37 +0200)
src/auth/password-scheme-crypt.c
src/auth/password-scheme.h

index 3706536f2cc953f1526737d26c85a27a61c93675..8d26452e4502c26d92db3e7a64239faf8334e591 100644 (file)
 #define CRYPT_SHA2_ROUNDS_MAX 999999999
 #define CRYPT_SHA2_SALT_LEN 16
 
-static unsigned int encryption_rounds = 0;
+unsigned int password_scheme_encryption_rounds = 0;
 
 void password_set_encryption_rounds(unsigned int rounds)
 {
        /* just take the new value. crypt_generate_*() will enforce their
           limits. */
-       encryption_rounds = rounds;
+       password_scheme_encryption_rounds = rounds;
 }
 
 static void
@@ -41,7 +41,7 @@ crypt_generate_blowfisch(const char *plaintext, const char *user ATTR_UNUSED,
                         const unsigned char **raw_password_r, size_t *size_r)
 {
        const char *password, *salt, *magic_salt;
-       unsigned int rounds = encryption_rounds;
+       unsigned int rounds = password_scheme_encryption_rounds;
 
        if (rounds == 0)
                rounds = CRYPT_BLF_ROUNDS_DEFAULT;
@@ -62,7 +62,7 @@ crypt_generate_sha256(const char *plaintext, const char *user ATTR_UNUSED,
                      const unsigned char **raw_password_r, size_t *size_r)
 {
        const char *password, *salt, *magic_salt;
-       unsigned int rounds = encryption_rounds;
+       unsigned int rounds = password_scheme_encryption_rounds;
 
        if (rounds == 0)
                rounds = CRYPT_SHA2_ROUNDS_DEFAULT;
@@ -86,7 +86,7 @@ crypt_generate_sha512(const char *plaintext, const char *user ATTR_UNUSED,
                      const unsigned char **raw_password_r, size_t *size_r)
 {
        const char *password, *salt, *magic_salt;
-       unsigned int rounds = encryption_rounds;
+       unsigned int rounds = password_scheme_encryption_rounds;
 
        if (rounds == 0)
                rounds = CRYPT_SHA2_ROUNDS_DEFAULT;
index f5aa2c04ecfbee3db83e621dadacf532205d02a3..438e849919d6a53ee3886d2ead42d02502659e59 100644 (file)
@@ -25,6 +25,7 @@ struct password_scheme {
 ARRAY_DEFINE_TYPE(password_scheme_p, const struct password_scheme *);
 
 extern ARRAY_TYPE(password_scheme_p) password_schemes;
+extern unsigned int password_scheme_encryption_rounds;
 
 /* Returns 1 = matched, 0 = didn't match, -1 = unknown scheme or invalid
    raw_password */