changeset 1723:c090fc199013 HEAD

Reading global auth_* defaults didn't work
author Timo Sirainen <tss@iki.fi>
date Sun, 24 Aug 2003 10:21:30 +0300
parents 629eb2888e6d
children b3526668de78
files src/master/master-settings.c src/master/master-settings.h
diffstat 2 files changed, 19 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/master/master-settings.c	Sun Aug 24 10:06:06 2003 +0300
+++ b/src/master/master-settings.c	Sun Aug 24 10:21:30 2003 +0300
@@ -512,7 +512,7 @@
 	auth = p_new(settings_pool, struct auth_settings, 1);
 
 	/* copy defaults */
-	*auth = default_auth_settings;
+	*auth = server->auth_defaults;
 	auth->parent = server;
 	auth->name = p_strdup(settings_pool, name);
 
@@ -619,13 +619,7 @@
 		if (error == NULL)
 			return NULL;
 
-		/* backwards compatibility */
 		if (strncmp(key, "auth_", 5) == 0) {
-			if (ctx->auth == NULL) {
-				return "Authentication process name "
-					"not defined yet";
-			}
-
 			return parse_setting_from_defs(settings_pool,
 						       auth_setting_defs,
 						       ctx->auth,
@@ -633,6 +627,8 @@
 		}
 		return error;
 	case SETTINGS_TYPE_AUTH:
+		if (strncmp(key, "auth_", 5) == 0)
+			key += 5;
 		return parse_setting_from_defs(settings_pool, auth_setting_defs,
 					       ctx->auth, key, value);
 	case SETTINGS_TYPE_NAMESPACE:
@@ -655,6 +651,7 @@
 	server->name = p_strdup(settings_pool, name);
 	server->imap = p_new(settings_pool, struct settings, 1);
 	server->pop3 = p_new(settings_pool, struct settings, 1);
+	server->auth_defaults = default_auth_settings;
 
 	*server->imap = *imap_defaults;
 	*server->pop3 = *pop3_defaults;
@@ -687,7 +684,7 @@
 			ctx->type = ctx->parent_type;
 			ctx->parent_type = SETTINGS_TYPE_ROOT;
 			ctx->server = ctx->root;
-			ctx->auth = NULL;
+			ctx->auth = &ctx->root->auth_defaults;
 			ctx->namespace = NULL;
 		}
 		return TRUE;
@@ -702,8 +699,7 @@
 		ctx->parent_type = ctx->type;
 		ctx->type = SETTINGS_TYPE_SERVER;
 
-		ctx->server = create_new_server(name,
-						ctx->server->imap,
+		ctx->server = create_new_server(name, ctx->server->imap,
 						ctx->server->pop3);
                 server = ctx->root;
 		while (server->next != NULL)
@@ -778,6 +774,7 @@
 	ctx.server = ctx.root =
 		create_new_server("default",
 				  &default_settings, &default_settings);
+	ctx.auth = &ctx.server->auth_defaults;
 
 	if (!settings_read(path, NULL, parse_setting, parse_section, &ctx))
 		return FALSE;
--- a/src/master/master-settings.h	Sun Aug 24 10:06:06 2003 +0300
+++ b/src/master/master-settings.h	Sun Aug 24 10:21:30 2003 +0300
@@ -7,17 +7,6 @@
         MAIL_PROTOCOL_POP3
 };
 
-struct server_settings {
-	struct server_settings *next;
-
-	const char *name;
-	struct settings *defaults;
-	struct settings *imap;
-	struct settings *pop3;
-	struct auth_settings *auths;
-        struct namespace_settings *namespaces;
-};
-
 struct settings {
 	struct server_settings *server;
 	enum mail_protocol protocol;
@@ -129,6 +118,18 @@
 	const char *location;
 };
 
+struct server_settings {
+	struct server_settings *next;
+
+	const char *name;
+	struct settings *defaults;
+	struct settings *imap;
+	struct settings *pop3;
+	struct auth_settings *auths;
+	struct auth_settings auth_defaults;
+        struct namespace_settings *namespaces;
+};
+
 extern struct server_settings *settings_root;
 
 int master_settings_read(const char *path);