changeset 9261:5e80d667a827 HEAD

auth settings: Make sure we have a section name defined.
author Timo Sirainen <tss@iki.fi>
date Mon, 11 May 2009 20:08:39 -0400
parents 36bdeba8f39a
children 7604073a4ccc
files src/auth/auth-settings.c
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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
@@ -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 @@
 	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 @@
 	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)
 {