Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
dovecot23.16061
0010-lib-smtp-smtp-server-command-Perform-initi...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0010-lib-smtp-smtp-server-command-Perform-initial-command.patch of Package dovecot23.16061
From 563bf21d8228a3c06c63b3f289a90ca3d0c579a4 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan.bosch@open-xchange.com> Date: Tue, 24 Mar 2020 12:23:32 +0100 Subject: [PATCH 10/16] lib-smtp: smtp-server-command - Perform initial command execution in separate function. --- src/lib-smtp/smtp-server-command.c | 11 +++++++++-- src/lib-smtp/smtp-server-connection.c | 3 ++- src/lib-smtp/smtp-server-private.h | 7 +++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/lib-smtp/smtp-server-command.c b/src/lib-smtp/smtp-server-command.c index b5cdf992bf..67424b60a7 100644 --- a/src/lib-smtp/smtp-server-command.c +++ b/src/lib-smtp/smtp-server-command.c @@ -179,7 +179,7 @@ smtp_server_command_new_invalid(struct smtp_server_connection *conn) struct smtp_server_command * smtp_server_command_new(struct smtp_server_connection *conn, - const char *name, const char *params) + const char *name) { struct smtp_server *server = conn->server; struct smtp_server_command *cmd; @@ -195,6 +195,14 @@ smtp_server_command_new(struct smtp_server_connection *conn, set_name("smtp_server_command_started"); e_debug(e->event(), "New command"); + return cmd; +} + +void smtp_server_command_execute(struct smtp_server_command *cmd, + const char *params) +{ + struct smtp_server_connection *conn = cmd->context.conn; + if (cmd->reg == NULL) { /* RFC 5321, Section 4.2.4: Reply Code 502 @@ -251,7 +259,6 @@ smtp_server_command_new(struct smtp_server_connection *conn, if (!smtp_server_command_unref(&tmp_cmd)) cmd = NULL; } - return cmd; } void smtp_server_command_ref(struct smtp_server_command *cmd) diff --git a/src/lib-smtp/smtp-server-connection.c b/src/lib-smtp/smtp-server-connection.c index 1bfb728591..24843088fc 100644 --- a/src/lib-smtp/smtp-server-connection.c +++ b/src/lib-smtp/smtp-server-connection.c @@ -295,7 +295,8 @@ smtp_server_connection_handle_command(struct smtp_server_connection *conn, struct smtp_server_command *cmd; smtp_server_connection_ref(tmp_conn); - cmd = smtp_server_command_new(tmp_conn, cmd_name, cmd_params); + cmd = smtp_server_command_new(tmp_conn, cmd_name); + smtp_server_command_execute(cmd, cmd_params); if (!smtp_server_connection_unref(&tmp_conn)) { /* the command start callback managed to get this connection destroyed */ diff --git a/src/lib-smtp/smtp-server-private.h b/src/lib-smtp/smtp-server-private.h index e0f2d8d274..aa0d30a5ea 100644 --- a/src/lib-smtp/smtp-server-private.h +++ b/src/lib-smtp/smtp-server-private.h @@ -241,8 +241,11 @@ void smtp_server_command_debug(struct smtp_server_cmd_ctx *cmd, struct smtp_server_command * smtp_server_command_new_invalid(struct smtp_server_connection *conn); struct smtp_server_command * -smtp_server_command_new(struct smtp_server_connection *conn, - const char *name, const char *params); +smtp_server_command_new(struct smtp_server_connection *conn, const char *name); + +void smtp_server_command_execute(struct smtp_server_command *cmd, + const char *params); + void smtp_server_command_ref(struct smtp_server_command *cmd); bool smtp_server_command_unref(struct smtp_server_command **_cmd); void smtp_server_command_abort(struct smtp_server_command **_cmd); -- 2.11.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor