Mercurial > dovecot > core-2.2
changeset 10039:ddcc3391adf9 HEAD
lmtp: Added lmtp_proxy setting (it's no longer hardcoded to yes).
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 12 Oct 2009 13:53:36 -0400 |
parents | 499f5575d503 |
children | 21636cae54e6 |
files | src/lmtp/Makefile.am src/lmtp/client.c src/lmtp/client.h src/lmtp/commands.c src/lmtp/lmtp-settings.c src/lmtp/lmtp-settings.h src/lmtp/main.c |
diffstat | 7 files changed, 61 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lmtp/Makefile.am Mon Oct 12 12:54:37 2009 -0400 +++ b/src/lmtp/Makefile.am Mon Oct 12 13:53:36 2009 -0400 @@ -30,10 +30,12 @@ main.c \ client.c \ commands.c \ - lmtp-proxy.c + lmtp-proxy.c \ + lmtp-settings.c noinst_HEADERS = \ main.h \ client.h \ commands.h \ - lmtp-proxy.h + lmtp-proxy.h \ + lmtp-settings.h
--- a/src/lmtp/client.c Mon Oct 12 12:54:37 2009 -0400 +++ b/src/lmtp/client.c Mon Oct 12 13:53:36 2009 -0400 @@ -162,7 +162,6 @@ client->my_domain = my_hostname; client->state_pool = pool_alloconly_create("client state", 4096); client->state.mail_data_fd = -1; - client->try_proxying = TRUE; // FIXME: setting! DLLIST_PREPEND(&clients, client); clients_count++;
--- a/src/lmtp/client.h Mon Oct 12 12:54:37 2009 -0400 +++ b/src/lmtp/client.h Mon Oct 12 13:53:36 2009 -0400 @@ -35,6 +35,7 @@ struct client *prev, *next; const struct lda_settings *set; + const struct lmtp_settings *lmtp_set; int fd_in, fd_out; struct io *io; struct istream *input; @@ -55,7 +56,6 @@ struct lmtp_proxy *proxy; unsigned int disconnected:1; - unsigned int try_proxying:1; unsigned int mail_body_7bit:1; unsigned int mail_body_8bitmime:1; };
--- a/src/lmtp/commands.c Mon Oct 12 12:54:37 2009 -0400 +++ b/src/lmtp/commands.c Mon Oct 12 13:53:36 2009 -0400 @@ -13,6 +13,7 @@ #include "mail-storage-service.h" #include "index/raw/raw-storage.h" #include "lda-settings.h" +#include "lmtp-settings.h" #include "mail-deliver.h" #include "main.h" #include "client.h" @@ -265,7 +266,7 @@ return 0; } - if (client->try_proxying) { + if (client->lmtp_set->lmtp_proxy) { if (client_proxy_rcpt(client, name)) return 0; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lmtp/lmtp-settings.c Mon Oct 12 13:53:36 2009 -0400 @@ -0,0 +1,36 @@ +/* Copyright (c) 2009 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "settings-parser.h" +#include "master-service-settings.h" +#include "lmtp-settings.h" + +#include <stddef.h> +#include <unistd.h> + +#undef DEF +#define DEF(type, name) \ + { type, #name, offsetof(struct lmtp_settings, name), NULL } + +static struct setting_define lmtp_setting_defines[] = { + DEF(SET_BOOL, lmtp_proxy), + + SETTING_DEFINE_LIST_END +}; + +static struct lmtp_settings lmtp_default_settings = { + MEMBER(lmtp_proxy) FALSE +}; + +struct setting_parser_info lmtp_setting_parser_info = { + MEMBER(defines) lmtp_setting_defines, + MEMBER(defaults) &lmtp_default_settings, + + MEMBER(parent) NULL, + MEMBER(dynamic_parsers) NULL, + + MEMBER(parent_offset) (size_t)-1, + MEMBER(type_offset) (size_t)-1, + MEMBER(struct_size) sizeof(struct lmtp_settings), + MEMBER(check_func) NULL +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lmtp/lmtp-settings.h Mon Oct 12 13:53:36 2009 -0400 @@ -0,0 +1,10 @@ +#ifndef LMTP_SETTINGS_H +#define LMTP_SETTINGS_H + +struct lmtp_settings { + bool lmtp_proxy; +}; + +extern struct setting_parser_info lmtp_setting_parser_info; + +#endif
--- a/src/lmtp/main.c Mon Oct 12 12:54:37 2009 -0400 +++ b/src/lmtp/main.c Mon Oct 12 13:53:36 2009 -0400 @@ -7,9 +7,11 @@ #include "fd-close-on-exec.h" #include "process-title.h" #include "master-service.h" +#include "master-service-settings.h" #include "master-interface.h" #include "mail-storage-service.h" #include "lda-settings.h" +#include "lmtp-settings.h" #include "client.h" #include "main.h" @@ -26,11 +28,15 @@ static void client_connected(const struct master_service_connection *conn) { struct client *client; + void **sets; client = client_create(conn->fd, conn->fd); client->remote_ip = conn->remote_ip; client->remote_port = conn->remote_port; - client->set = mail_storage_service_get_settings(master_service); + + sets = master_service_settings_get_others(master_service); + client->set = sets[1]; + client->lmtp_set = sets[2]; (void)net_getsockname(conn->fd, &client->local_ip, &client->local_port); } @@ -50,6 +56,7 @@ { const struct setting_parser_info *set_roots[] = { &lda_setting_parser_info, + &lmtp_setting_parser_info, NULL }; enum master_service_flags service_flags = 0;