dovecot-2.0: lmtp: Added lmtp_proxy setting (it's no longer hard...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 12 20:53:53 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/ddcc3391adf9
changeset: 10039:ddcc3391adf9
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 12 13:53:36 2009 -0400
description:
lmtp: Added lmtp_proxy setting (it's no longer hardcoded to yes).

diffstat:

7 files changed, 61 insertions(+), 6 deletions(-)
src/lmtp/Makefile.am     |    6 ++++--
src/lmtp/client.c        |    1 -
src/lmtp/client.h        |    2 +-
src/lmtp/commands.c      |    3 ++-
src/lmtp/lmtp-settings.c |   36 ++++++++++++++++++++++++++++++++++++
src/lmtp/lmtp-settings.h |   10 ++++++++++
src/lmtp/main.c          |    9 ++++++++-

diffs (162 lines):

diff -r 499f5575d503 -r ddcc3391adf9 src/lmtp/Makefile.am
--- 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 @@ lmtp_SOURCES = \
 	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
diff -r 499f5575d503 -r ddcc3391adf9 src/lmtp/client.c
--- 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 @@ struct client *client_create(int fd_in, 
 	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++;
diff -r 499f5575d503 -r ddcc3391adf9 src/lmtp/client.h
--- 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 {
 	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 client {
 	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;
 };
diff -r 499f5575d503 -r ddcc3391adf9 src/lmtp/commands.c
--- 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 @@ int cmd_rcpt(struct client *client, cons
 		return 0;
 	}
 
-	if (client->try_proxying) {
+	if (client->lmtp_set->lmtp_proxy) {
 		if (client_proxy_rcpt(client, name))
 			return 0;
 	}
diff -r 499f5575d503 -r ddcc3391adf9 src/lmtp/lmtp-settings.c
--- /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
+};
diff -r 499f5575d503 -r ddcc3391adf9 src/lmtp/lmtp-settings.h
--- /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
diff -r 499f5575d503 -r ddcc3391adf9 src/lmtp/main.c
--- 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 struc
 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 @@ int main(int argc, char *argv[], char *e
 {
 	const struct setting_parser_info *set_roots[] = {
 		&lda_setting_parser_info,
+		&lmtp_setting_parser_info,
 		NULL
 	};
 	enum master_service_flags service_flags = 0;


More information about the dovecot-cvs mailing list