diff src/auth/auth-settings.c @ 12087:27d235096cca

auth: Fail if auth_cache_size value is too small.
author Timo Sirainen <tss@iki.fi>
date Wed, 08 Sep 2010 14:55:57 +0100
parents d41694c931d0
children 52e197994a55
line wrap: on
line diff
--- a/src/auth/auth-settings.c	Wed Sep 08 14:47:45 2010 +0100
+++ b/src/auth/auth-settings.c	Wed Sep 08 14:55:57 2010 +0100
@@ -256,7 +256,7 @@
 
 /* <settings checks> */
 static bool auth_settings_check(void *_set, pool_t pool,
-				const char **error_r ATTR_UNUSED)
+				const char **error_r)
 {
 	struct auth_settings *set = _set;
 	const char *p;
@@ -266,6 +266,15 @@
 	if (set->debug)
 		set->verbose = TRUE;
 
+	if (set->cache_size < 1024) {
+		/* probably a configuration error.
+		   older versions used megabyte numbers */
+		*error_r = t_strdup_printf("auth_cache_size value is too small "
+					   "(%"PRIuUOFF_T" bytes)",
+					   set->cache_size);
+		return FALSE;
+	}
+
 	if (*set->username_chars == '\0') {
 		/* all chars are allowed */
 		memset(set->username_chars_map, 1,