]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Implement basic client vfuncs.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 2 Nov 2018 22:48:48 +0000 (23:48 +0100)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 25 Jun 2019 11:19:16 +0000 (11:19 +0000)
Currently, only client_destroy can be overriden.

src/lmtp/client.c
src/lmtp/client.h

index f3820d8de55aa9d74fadddbf597e3e26f5203238..777929754e37fd77b87c7d794207c930b3e06674 100644 (file)
 
 #define CLIENT_IDLE_TIMEOUT_MSECS (1000*60*5)
 
+static const struct smtp_server_callbacks lmtp_callbacks;
+static const struct lmtp_client_vfuncs lmtp_client_vfuncs;
+
 static struct client *clients = NULL;
 static unsigned int clients_count = 0;
 
 static bool verbose_proctitle = FALSE;
 
-static const struct smtp_server_callbacks lmtp_callbacks;
-
 static const char *client_remote_id(struct client *client)
 {
        const char *addr;
@@ -125,6 +126,7 @@ struct client *client_create(int fd_in, int fd_out,
        pool = pool_alloconly_create("lmtp client", 2048);
        client = p_new(pool, struct client, 1);
        client->pool = pool;
+       client->v = lmtp_client_vfuncs;
        client->remote_ip = conn->remote_ip;
        client->remote_port = conn->remote_port;
        client->local_ip = conn->local_ip;
@@ -189,6 +191,13 @@ void client_state_reset(struct client *client)
 
 void client_destroy(struct client *client, const char *enh_code,
                    const char *reason)
+{
+       client->v.destroy(client, enh_code, reason);
+}
+
+static void
+client_default_destroy(struct client *client, const char *enh_code,
+                      const char *reason)
 {
        if (client->destroyed)
                return;
@@ -336,3 +345,7 @@ static const struct smtp_server_callbacks lmtp_callbacks = {
 
        .conn_is_trusted = client_connection_is_trusted
 };
+
+static const struct lmtp_client_vfuncs lmtp_client_vfuncs = {
+       .destroy = client_default_destroy,
+};
index ff5bf6ec4bcced97b7c0f6462a240c1933e8839b..e74be37642267392c6942fc9fdddadb1520e37a1 100644 (file)
@@ -6,6 +6,8 @@
 
 #define CLIENT_MAIL_DATA_MAX_INMEMORY_SIZE (1024*128)
 
+struct client;
+
 struct client_state {
        const char *name;
        unsigned int session_id_seq;
@@ -18,10 +20,17 @@ struct client_state {
        const char *added_headers_proxy;
 };
 
+struct lmtp_client_vfuncs {
+       void (*destroy)(struct client *client, const char *enh_code,
+                       const char *reason);
+};
+
 struct client {
        struct client *prev, *next;
        pool_t pool;
 
+       struct lmtp_client_vfuncs v;
+
        const struct setting_parser_info *user_set_info;
        const struct lda_settings *unexpanded_lda_set;
        const struct lmtp_settings *lmtp_set;