]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth settings: Make sure we have a section name defined.
authorTimo Sirainen <tss@iki.fi>
Tue, 12 May 2009 00:08:39 +0000 (20:08 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 12 May 2009 00:08:39 +0000 (20:08 -0400)
--HG--
branch : HEAD

src/auth/auth-settings.c

index 6539a4cd77be48e739a40458c5d331cb95f1bf90..eabae702a2557aa3db0d03b7fa39fd4ca9a43a2c 100644 (file)
@@ -11,6 +11,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) \
        { type, #name, offsetof(struct auth_passdb_settings, name), NULL }
@@ -141,7 +143,7 @@ struct setting_parser_info auth_setting_parser_info = {
        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
@@ -173,6 +175,19 @@ struct setting_parser_info auth_root_setting_parser_info = {
        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)
 {