From: Stephan Bosch Date: Sun, 9 Sep 2018 23:07:58 +0000 (+0200) Subject: submission: Move relay part of VRFY command to submission-backend-relay.c. X-Git-Tag: 2.3.9~1332 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39a9bb235128235b9c2373644fb2a78f463373f6;p=thirdparty%2Fdovecot%2Fcore.git submission: Move relay part of VRFY command to submission-backend-relay.c. --- diff --git a/src/submission/Makefile.am b/src/submission/Makefile.am index 920f5c9683..b531a62c96 100644 --- a/src/submission/Makefile.am +++ b/src/submission/Makefile.am @@ -35,8 +35,7 @@ submission_DEPENDENCIES = \ cmds = \ cmd-noop.c \ - cmd-quit.c \ - cmd-vrfy.c + cmd-quit.c submission_SOURCES = \ $(cmds) \ diff --git a/src/submission/cmd-vrfy.c b/src/submission/cmd-vrfy.c deleted file mode 100644 index e4be183b38..0000000000 --- a/src/submission/cmd-vrfy.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */ - -#include "submission-common.h" -#include "smtp-syntax.h" -#include "smtp-client.h" -#include "smtp-client-connection.h" - -#include "submission-commands.h" - -/* - * VRFY command - */ - -struct cmd_vrfy_context { - struct client *client; - struct smtp_server_cmd_ctx *cmd; - struct smtp_client_command *cmd_proxied; -}; - -static void cmd_vrfy_proxy_cb(const struct smtp_reply *proxy_reply, - struct cmd_vrfy_context *vrfy_cmd) -{ - struct smtp_server_cmd_ctx *cmd = vrfy_cmd->cmd; - struct client *client = vrfy_cmd->client; - struct smtp_reply reply; - - if (!client_command_handle_proxy_reply(client, proxy_reply, &reply)) - return; - - if (!smtp_reply_has_enhanced_code(proxy_reply)) { - switch (proxy_reply->status) { - case 250: - case 251: - case 252: - reply.enhanced_code = SMTP_REPLY_ENH_CODE(2, 5, 0); - break; - default: - break; - } - } - - smtp_server_reply_forward(cmd, &reply); -} - -int cmd_vrfy_relay(struct client *client, struct smtp_server_cmd_ctx *cmd, - const char *param) -{ - struct cmd_vrfy_context *vrfy_cmd; - - vrfy_cmd = p_new(cmd->pool, struct cmd_vrfy_context, 1); - vrfy_cmd->client = client; - vrfy_cmd->cmd = cmd; - - vrfy_cmd->cmd_proxied = smtp_client_command_vrfy_submit( - client->proxy_conn, 0, param, cmd_vrfy_proxy_cb, vrfy_cmd); - return 0; -} - diff --git a/src/submission/submission-backend-relay.c b/src/submission/submission-backend-relay.c index 9f0c3e6d88..960e6b579d 100644 --- a/src/submission/submission-backend-relay.c +++ b/src/submission/submission-backend-relay.c @@ -487,3 +487,53 @@ int cmd_data_relay(struct client *client, struct smtp_server_cmd_ctx *cmd, client->proxy_conn, 0, data_input, cmd_data_proxy_cb, data_ctx); return 0; } + +/* + * VRFY command + */ + +struct cmd_vrfy_context { + struct client *client; + struct smtp_server_cmd_ctx *cmd; + struct smtp_client_command *cmd_proxied; +}; + +static void cmd_vrfy_proxy_cb(const struct smtp_reply *proxy_reply, + struct cmd_vrfy_context *vrfy_cmd) +{ + struct smtp_server_cmd_ctx *cmd = vrfy_cmd->cmd; + struct client *client = vrfy_cmd->client; + struct smtp_reply reply; + + if (!client_command_handle_proxy_reply(client, proxy_reply, &reply)) + return; + + if (!smtp_reply_has_enhanced_code(proxy_reply)) { + switch (proxy_reply->status) { + case 250: + case 251: + case 252: + reply.enhanced_code = SMTP_REPLY_ENH_CODE(2, 5, 0); + break; + default: + break; + } + } + + smtp_server_reply_forward(cmd, &reply); +} + +int cmd_vrfy_relay(struct client *client, struct smtp_server_cmd_ctx *cmd, + const char *param) +{ + struct cmd_vrfy_context *vrfy_cmd; + + vrfy_cmd = p_new(cmd->pool, struct cmd_vrfy_context, 1); + vrfy_cmd->client = client; + vrfy_cmd->cmd = cmd; + + vrfy_cmd->cmd_proxied = smtp_client_command_vrfy_submit( + client->proxy_conn, 0, param, cmd_vrfy_proxy_cb, vrfy_cmd); + return 0; +} + diff --git a/src/submission/submission-backend-relay.h b/src/submission/submission-backend-relay.h index 8d0864473b..f7f1f8c228 100644 --- a/src/submission/submission-backend-relay.h +++ b/src/submission/submission-backend-relay.h @@ -11,5 +11,7 @@ int cmd_rset_relay(struct client *client, struct smtp_server_cmd_ctx *cmd); int cmd_data_relay(struct client *client, struct smtp_server_cmd_ctx *cmd, struct smtp_server_transaction *trans, struct istream *data_input); +int cmd_vrfy_relay(struct client *client, struct smtp_server_cmd_ctx *cmd, + const char *param); #endif diff --git a/src/submission/submission-commands.h b/src/submission/submission-commands.h index 285e5cd293..3945d0b1d2 100644 --- a/src/submission/submission-commands.h +++ b/src/submission/submission-commands.h @@ -4,8 +4,6 @@ bool client_command_handle_proxy_reply(struct client *client, const struct smtp_reply *reply, struct smtp_reply *reply_r); -int cmd_vrfy_relay(struct client *client, struct smtp_server_cmd_ctx *cmd, - const char *param); 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);