diff --git a/src/lmtp/commands.c b/src/lmtp/commands.c index c924cd18f4..8e855d9803 100644 --- a/src/lmtp/commands.c +++ b/src/lmtp/commands.c @@ -388,37 +388,6 @@ static bool client_proxy_rcpt(struct client *client, return TRUE; } -static void rcpt_anvil_lookup_callback(const char *reply, void *context) -{ - struct mail_recipient *rcpt = context; - struct client *client = rcpt->client; - const struct mail_storage_service_input *input; - unsigned int parallel_count = 0; - - rcpt->anvil_query = NULL; - if (reply == NULL) { - /* lookup failed */ - } else if (str_to_uint(reply, ¶llel_count) < 0) { - i_error("Invalid reply from anvil: %s", reply); - } - - if (parallel_count >= client->lmtp_set->lmtp_user_concurrency_limit) { - client_send_line(client, ERRSTR_TEMP_USERDB_FAIL_PREFIX - "Too many concurrent deliveries for user", - smtp_address_encode(rcpt->address)); - mail_storage_service_user_unref(&rcpt->service_user); - } else if (cmd_rcpt_finish(client, rcpt)) { - rcpt->anvil_connect_sent = TRUE; - input = mail_storage_service_user_get_input(rcpt->service_user); - master_service_anvil_send(master_service, t_strconcat( - "CONNECT\t", my_pid, "\t", master_service_get_name(master_service), - "/", input->username, "\n", NULL)); - } - - client_io_reset(client); - client_input_handle(client); -} - int cmd_rcpt(struct client *client, const char *args) { struct mail_recipient *rcpt; diff --git a/src/lmtp/lmtp-local.c b/src/lmtp/lmtp-local.c index 7b86925549..6de531a6dc 100644 --- a/src/lmtp/lmtp-local.c +++ b/src/lmtp/lmtp-local.c @@ -14,6 +14,7 @@ #include "lmtp-local.h" #define ERRSTR_TEMP_MAILBOX_FAIL "451 4.3.0 <%s> Temporary internal error" +#define ERRSTR_TEMP_USERDB_FAIL_PREFIX "451 4.3.0 <%s> " void client_rcpt_anvil_disconnect(const struct mail_recipient *rcpt) { @@ -109,3 +110,34 @@ bool cmd_rcpt_finish(struct client *client, struct mail_recipient *rcpt) client_send_line(client, "250 2.1.5 OK"); return TRUE; } + +void rcpt_anvil_lookup_callback(const char *reply, void *context) +{ + struct mail_recipient *rcpt = context; + struct client *client = rcpt->client; + const struct mail_storage_service_input *input; + unsigned int parallel_count = 0; + + rcpt->anvil_query = NULL; + if (reply == NULL) { + /* lookup failed */ + } else if (str_to_uint(reply, ¶llel_count) < 0) { + i_error("Invalid reply from anvil: %s", reply); + } + + if (parallel_count >= client->lmtp_set->lmtp_user_concurrency_limit) { + client_send_line(client, ERRSTR_TEMP_USERDB_FAIL_PREFIX + "Too many concurrent deliveries for user", + smtp_address_encode(rcpt->address)); + mail_storage_service_user_unref(&rcpt->service_user); + } else if (cmd_rcpt_finish(client, rcpt)) { + rcpt->anvil_connect_sent = TRUE; + input = mail_storage_service_user_get_input(rcpt->service_user); + master_service_anvil_send(master_service, t_strconcat( + "CONNECT\t", my_pid, "\t", master_service_get_name(master_service), + "/", input->username, "\n", NULL)); + } + + client_io_reset(client); + client_input_handle(client); +} diff --git a/src/lmtp/lmtp-local.h b/src/lmtp/lmtp-local.h index 2e172266cc..9e43200cfa 100644 --- a/src/lmtp/lmtp-local.h +++ b/src/lmtp/lmtp-local.h @@ -11,4 +11,6 @@ void client_send_line_overquota(struct client *client, bool cmd_rcpt_finish(struct client *client, struct mail_recipient *rcpt); +void rcpt_anvil_lookup_callback(const char *reply, void *context); + #endif