From: Timo Sirainen Date: Sun, 24 Aug 2003 07:21:30 +0000 (+0300) Subject: Reading global auth_* defaults didn't work X-Git-Tag: 1.1.alpha1~4383 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63ef7e872eb3e82048a1212006c9d3a75f766be8;p=thirdparty%2Fdovecot%2Fcore.git Reading global auth_* defaults didn't work --HG-- branch : HEAD --- diff --git a/src/master/master-settings.c b/src/master/master-settings.c index 4942f2c6ab..3678d853c2 100644 --- a/src/master/master-settings.c +++ b/src/master/master-settings.c @@ -512,7 +512,7 @@ auth_settings_new(struct server_settings *server, const char *name) 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 @@ static const char *parse_setting(const char *key, const char *value, 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 @@ static const char *parse_setting(const char *key, const char *value, } 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 @@ create_new_server(const char *name, 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 @@ static int parse_section(const char *type, const char *name, void *context, 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 @@ static int parse_section(const char *type, const char *name, void *context, 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 @@ int master_settings_read(const char *path) 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; diff --git a/src/master/master-settings.h b/src/master/master-settings.h index cb4c150aec..761a30eaf6 100644 --- a/src/master/master-settings.h +++ b/src/master/master-settings.h @@ -7,17 +7,6 @@ enum mail_protocol { 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 @@ struct namespace_settings { 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);