]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
submission: Move client_proxy_start() to submission-backend-relay.c.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 1 Sep 2018 14:40:10 +0000 (16:40 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 9 Oct 2018 06:41:17 +0000 (06:41 +0000)
src/submission/submission-backend-relay.c
src/submission/submission-backend-relay.h
src/submission/submission-client.c

index d1410666f57a72e2ce529c084fb6098c30f52a12..ed211df426f2f92f3fc5775b32d88bba532c45e4 100644 (file)
@@ -677,3 +677,41 @@ int cmd_quit_relay(struct client *client, struct smtp_server_cmd_ctx *cmd)
                relay_cmd_quit_proxy(quit_cmd);
        return 0;
 }
+
+/*
+ * Relay backend
+ */
+
+static void client_proxy_ready_cb(const struct smtp_reply *reply,
+                                 void *context)
+{
+       struct client *client = context;
+       enum smtp_capability caps;
+
+       /* check proxy status */
+       if ((reply->status / 100) != 2) {
+               i_error("Failed to establish relay connection: %s",
+                       smtp_reply_log(reply));
+               client_destroy(client,
+                       "4.4.0", "Failed to establish relay connection");
+               return;
+       }
+
+       /* propagate capabilities */
+       caps = smtp_client_connection_get_capabilities(client->proxy_conn);
+       caps |= SMTP_CAPABILITY_AUTH | SMTP_CAPABILITY_PIPELINING |
+               SMTP_CAPABILITY_SIZE | SMTP_CAPABILITY_ENHANCEDSTATUSCODES |
+               SMTP_CAPABILITY_CHUNKING | SMTP_CAPABILITY_BURL |
+               SMTP_CAPABILITY_VRFY;
+       caps &= SUBMISSION_SUPPORTED_SMTP_CAPABILITIES;
+       smtp_server_connection_set_capabilities(client->conn, caps);
+
+       /* now that we know our capabilities, commence server protocol dialog */
+       smtp_server_connection_resume(client->conn);
+}
+
+void client_proxy_start(struct client *client)
+{
+       smtp_client_connection_connect(client->proxy_conn,
+               client_proxy_ready_cb, client);
+}
index 14dc38fe6b51a21b63b40b6a53fadb0254501891..df06c082b6516295a53d7ffca0aa4191c7b349d9 100644 (file)
@@ -16,4 +16,6 @@ int cmd_vrfy_relay(struct client *client, struct smtp_server_cmd_ctx *cmd,
 int cmd_noop_relay(struct client *client, struct smtp_server_cmd_ctx *cmd);
 int cmd_quit_relay(struct client *client, struct smtp_server_cmd_ctx *cmd);
 
+void client_proxy_start(struct client *client);
+
 #endif
index a4c4abcac74250f6a30f7652e0f9ebdd635345a1..90952582e67837fe57468912de2641900c350169 100644 (file)
@@ -23,6 +23,7 @@
 #include "smtp-client.h"
 #include "smtp-client-connection.h"
 
+#include "submission-backend-relay.h"
 #include "submission-commands.h"
 #include "submission-settings.h"
 
@@ -82,40 +83,6 @@ static const char *client_remote_id(struct client *client)
        return addr;
 }
 
-static void client_proxy_ready_cb(const struct smtp_reply *reply,
-                                 void *context)
-{
-       struct client *client = context;
-       enum smtp_capability caps;
-
-       /* check proxy status */
-       if ((reply->status / 100) != 2) {
-               i_error("Failed to establish relay connection: %s",
-                       smtp_reply_log(reply));
-               client_destroy(client,
-                       "4.4.0", "Failed to establish relay connection");
-               return;
-       }
-
-       /* propagate capabilities */
-       caps = smtp_client_connection_get_capabilities(client->proxy_conn);
-       caps |= SMTP_CAPABILITY_AUTH | SMTP_CAPABILITY_PIPELINING |
-               SMTP_CAPABILITY_SIZE | SMTP_CAPABILITY_ENHANCEDSTATUSCODES |
-               SMTP_CAPABILITY_CHUNKING | SMTP_CAPABILITY_BURL |
-               SMTP_CAPABILITY_VRFY;
-       caps &= SUBMISSION_SUPPORTED_SMTP_CAPABILITIES;
-       smtp_server_connection_set_capabilities(client->conn, caps);
-
-       /* now that we know our capabilities, commence server protocol dialog */
-       smtp_server_connection_resume(client->conn);
-}
-
-static void client_proxy_start(struct client *client)
-{
-       smtp_client_connection_connect(client->proxy_conn,
-               client_proxy_ready_cb, client);
-}
-
 static void client_proxy_create(struct client *client,
                                const struct submission_settings *set)
 {