diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:36:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:36:47 +0000 |
commit | 0441d265f2bb9da249c7abf333f0f771fadb4ab5 (patch) | |
tree | 3f3789daa2f6db22da6e55e92bee0062a7d613fe /src/submission/submission-recipient.c | |
parent | Initial commit. (diff) | |
download | dovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.tar.xz dovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.zip |
Adding upstream version 1:2.3.21+dfsg1.upstream/1%2.3.21+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/submission/submission-recipient.c')
-rw-r--r-- | src/submission/submission-recipient.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/submission/submission-recipient.c b/src/submission/submission-recipient.c new file mode 100644 index 0000000..a49b038 --- /dev/null +++ b/src/submission/submission-recipient.c @@ -0,0 +1,55 @@ +/* Copyright (c) 2018 Dovecot authors, see the included COPYING file */ + +#include "submission-common.h" + +#include "submission-backend.h" +#include "submission-recipient.h" + +struct submission_recipient_module_register +submission_recipient_module_register = { 0 }; + +static void +submission_recipient_approved(struct smtp_server_recipient *rcpt ATTR_UNUSED, + struct submission_recipient *srcpt); + +struct submission_recipient * +submission_recipient_create(struct client *client, + struct smtp_server_recipient *rcpt) +{ + struct submission_recipient *srcpt; + + srcpt = p_new(rcpt->pool, struct submission_recipient, 1); + srcpt->rcpt = rcpt; + srcpt->backend = client->state.backend; + + rcpt->context = srcpt; + + p_array_init(&srcpt->module_contexts, rcpt->pool, 5); + + smtp_server_recipient_add_hook( + rcpt, SMTP_SERVER_RECIPIENT_HOOK_APPROVED, + submission_recipient_approved, srcpt); + + return srcpt; +} + +static void +submission_recipient_approved(struct smtp_server_recipient *rcpt ATTR_UNUSED, + struct submission_recipient *srcpt) +{ + struct submission_backend *backend = srcpt->backend; + struct client *client = backend->client; + struct submission_backend *rcpt_backend; + bool backend_found = FALSE; + + array_push_back(&client->rcpt_to, &srcpt); + + array_foreach_elem(&client->rcpt_backends, rcpt_backend) { + if (rcpt_backend == backend) { + backend_found = TRUE; + break; + } + } + if (!backend_found) + array_push_back(&client->rcpt_backends, &backend); +} |