]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
submission: relay backend: Fix non-transaction commands to work when submission_backe...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 18 Oct 2018 22:35:53 +0000 (00:35 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 12 Feb 2019 13:41:23 +0000 (15:41 +0200)
When submission_backend_capabilities is configured, the backend is not started
until the first transaction is started. But for commands that should work
outside the transaction, the backend should also be started, which was not the
case before this fix.

src/submission/submission-backend.c

index aea29b07aabe18231cbda9853f7bea5b723c4465..baff596a357b8b3e590f0d340dc78c887517757b 100644 (file)
@@ -317,6 +317,8 @@ int submission_backend_cmd_rcpt(struct submission_backend *backend,
        if (!submission_backend_handle_failure(backend, cmd))
                return -1;
 
+       i_assert(backend->started);
+
        if (backend->v.cmd_rcpt == NULL) {
                /* backend is not interested, respond right away */
                return 1;
@@ -337,6 +339,8 @@ int submission_backend_cmd_rset(struct submission_backend *backend,
        if (!submission_backend_handle_failure(backend, cmd))
                return -1;
 
+       submission_backend_start(backend);
+
        if (backend->v.cmd_rset == NULL) {
                /* backend is not interested, respond right away */
                return 1;
@@ -354,6 +358,8 @@ submission_backend_cmd_data(struct submission_backend *backend,
                return 0;
        }
 
+       i_assert(backend->started);
+
        return backend->v.cmd_data(backend, cmd, trans,
                                   backend->data_input, backend->data_size);
 }
@@ -398,6 +404,8 @@ int submission_backend_cmd_vrfy(struct submission_backend *backend,
        /* failure on default backend closes the client connection */
        i_assert(backend->fail_reason == NULL);
 
+       submission_backend_start(backend);
+
        if (backend->v.cmd_vrfy == NULL) {
                /* backend is not interested, respond right away */
                return 1;
@@ -411,6 +419,8 @@ int submission_backend_cmd_noop(struct submission_backend *backend,
        /* failure on default backend closes the client connection */
        i_assert(backend->fail_reason == NULL);
 
+       submission_backend_start(backend);
+
        if (backend->v.cmd_noop == NULL) {
                /* backend is not interested, respond right away */
                return 1;
@@ -424,6 +434,10 @@ int submission_backend_cmd_quit(struct submission_backend *backend,
        /* failure on default backend closes the client connection */
        i_assert(backend->fail_reason == NULL);
 
+       if (!backend->started) {
+               /* quit before backend even started */
+               return 1;
+       }
        if (backend->v.cmd_quit == NULL) {
                /* backend is not interested, respond right away */
                return 1;