]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Moved rcpt_anvil_lookup_callback() from commands.c to lmtp-local.c.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 17 Sep 2017 00:57:29 +0000 (02:57 +0200)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 7 Dec 2017 23:08:14 +0000 (00:08 +0100)
src/lmtp/commands.c
src/lmtp/lmtp-local.c
src/lmtp/lmtp-local.h

index c924cd18f4ad417842141087b090b3fb56a77047..8e855d98035acf39e81c1c51be22816b7a8b0b16 100644 (file)
@@ -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, &parallel_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;
index 7b8692554934191b034daa48bfa686707158f53c..6de531a6dcd84941e4ba104a58840c027befbbac 100644 (file)
@@ -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, &parallel_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);
+}
index 2e172266ccca6c916ad5e0038470f552e3cd7732..9e43200cfaaf7d01b9754af473cd85e08bb1a794 100644 (file)
@@ -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