dovecot-2.0: auth settings: Make sure we have a section name def...

dovecot at dovecot.org dovecot at dovecot.org
Tue May 12 03:10:36 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/5e80d667a827
changeset: 9261:5e80d667a827
user:      Timo Sirainen <tss at iki.fi>
date:      Mon May 11 20:08:39 2009 -0400
description:
auth settings: Make sure we have a section name defined.

diffstat:

1 file changed, 16 insertions(+), 1 deletion(-)
src/auth/auth-settings.c |   17 ++++++++++++++++-

diffs (41 lines):

diff -r 36bdeba8f39a -r 5e80d667a827 src/auth/auth-settings.c
--- a/src/auth/auth-settings.c	Mon May 11 19:28:42 2009 -0400
+++ b/src/auth/auth-settings.c	Mon May 11 20:08:39 2009 -0400
@@ -10,6 +10,8 @@
 
 extern struct setting_parser_info auth_setting_parser_info;
 extern struct setting_parser_info auth_root_setting_parser_info;
+
+static bool auth_settings_check(void *_set, pool_t pool, const char **error_r);
 
 #undef DEF
 #define DEF(type, name) \
@@ -141,7 +143,7 @@ struct setting_parser_info auth_setting_
 	MEMBER(parent_offset) offsetof(struct auth_settings, root),
 	MEMBER(type_offset) offsetof(struct auth_settings, name),
 	MEMBER(struct_size) sizeof(struct auth_settings),
-	MEMBER(check_func) NULL
+	MEMBER(check_func) auth_settings_check
 };
 
 #undef DEF
@@ -172,6 +174,19 @@ struct setting_parser_info auth_root_set
 	MEMBER(type_offset) (size_t)-1,
 	MEMBER(struct_size) sizeof(struct auth_root_settings)
 };
+
+/* <settings checks> */
+static bool auth_settings_check(void *_set, pool_t pool, const char **error_r)
+{
+	struct auth_settings *set = _set;
+
+	if (set->name == NULL) {
+		*error_r = "auth section is missing name";
+		return FALSE;
+	}
+	return TRUE;
+}
+/* </settings checks> */
 
 struct auth_settings *
 auth_settings_read(struct master_service *service, const char *name)


More information about the dovecot-cvs mailing list