changeset 19907:7dfc5b772791

auth: Make password_scheme_encryption_rounds extern to allow plugins to read it.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 01 Mar 2016 19:37:30 +0200
parents e47ace66bc42
children df3a742c6a34
files src/auth/password-scheme-crypt.c src/auth/password-scheme.h
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/password-scheme-crypt.c	Tue Mar 01 16:07:53 2016 +0200
+++ b/src/auth/password-scheme-crypt.c	Tue Mar 01 19:37:30 2016 +0200
@@ -14,13 +14,13 @@
 #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 @@
 			 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 @@
 		      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 @@
 		      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;
--- a/src/auth/password-scheme.h	Tue Mar 01 16:07:53 2016 +0200
+++ b/src/auth/password-scheme.h	Tue Mar 01 19:37:30 2016 +0200
@@ -25,6 +25,7 @@
 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 */