]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Added lmtp_proxy setting (it's no longer hardcoded to yes).
authorTimo Sirainen <tss@iki.fi>
Mon, 12 Oct 2009 17:53:36 +0000 (13:53 -0400)
committerTimo Sirainen <tss@iki.fi>
Mon, 12 Oct 2009 17:53:36 +0000 (13:53 -0400)
--HG--
branch : HEAD

src/lmtp/Makefile.am
src/lmtp/client.c
src/lmtp/client.h
src/lmtp/commands.c
src/lmtp/lmtp-settings.c [new file with mode: 0644]
src/lmtp/lmtp-settings.h [new file with mode: 0644]
src/lmtp/main.c

index d8628b32b4b1ff34c3c89cd5d16e807bb8ec0cff..92009c4c2c5d998d224b11fdb45b2a73b7331c0e 100644 (file)
@@ -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
index 70b96addf2aae943f9a2fe7e50d42c11325531c2..ad113c643c508b90cf6cdbb7f611cad086fce2c7 100644 (file)
@@ -162,7 +162,6 @@ struct client *client_create(int fd_in, int fd_out)
        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++;
index 0722cfb8638308c8652ccd4f2a1d1a6f6267a098..0e26c1a814d68f0f57884328521375f2f2f01c81 100644 (file)
@@ -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;
 };
index 1d33315625bf093a2ef8a2048764767ced2a7999..fd7d431172d6a6152f06069c7fc0f7d6885ca436 100644 (file)
@@ -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, const char *args)
                return 0;
        }
 
-       if (client->try_proxying) {
+       if (client->lmtp_set->lmtp_proxy) {
                if (client_proxy_rcpt(client, name))
                        return 0;
        }
diff --git a/src/lmtp/lmtp-settings.c b/src/lmtp/lmtp-settings.c
new file mode 100644 (file)
index 0000000..b6ef6df
--- /dev/null
@@ -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 --git a/src/lmtp/lmtp-settings.h b/src/lmtp/lmtp-settings.h
new file mode 100644 (file)
index 0000000..4191770
--- /dev/null
@@ -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
index bf46902cf7441f5b2174fc41d0b210d8802b9c58..0e14f6b733a50ff2c83083b0c4cf76c124fc0e6c 100644 (file)
@@ -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 @@ struct mail_storage_service_multi_ctx *multi_service;
 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 *envp[])
 {
        const struct setting_parser_info *set_roots[] = {
                &lda_setting_parser_info,
+               &lmtp_setting_parser_info,
                NULL
        };
        enum master_service_flags service_flags = 0;