]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Fix using doveadm_ssl setting from command line
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 14 Sep 2021 08:45:17 +0000 (11:45 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 17 Jan 2022 11:52:09 +0000 (13:52 +0200)
The doveadm_ssl setting was used only with proxying, but it can also be
used by doveadm CLI client to specify that it wants to connect to doveadm
SSL port.

src/doveadm/doveadm-mail-server.c

index 51a902f235915a02e9cbe658023e2f12dc7e4f41..ee594d592fe3fb82705a0196991bacf65c6e9f0f 100644 (file)
@@ -192,6 +192,18 @@ doveadm_cmd_pass_reply_parse(struct doveadm_mail_cmd_context *ctx,
        }
        if (proxy_set->username == NULL)
                proxy_set->username = orig_user;
+
+       /* These ssl_flags can also be used by doveadm CLI client when
+          connecting to doveadm-server (i.e. without proxy=y) */
+       if (proxy_set->ssl_flags != 0)
+               ;
+       else if (strcmp(ctx->set->doveadm_ssl, "ssl") == 0)
+               proxy_set->ssl_flags |= AUTH_PROXY_SSL_FLAG_YES;
+       else if (strcmp(ctx->set->doveadm_ssl, "starttls") == 0) {
+               proxy_set->ssl_flags |= AUTH_PROXY_SSL_FLAG_YES |
+                       AUTH_PROXY_SSL_FLAG_STARTTLS;
+       }
+
        if (!proxy_set->proxy)
                return 0;
 
@@ -213,15 +225,6 @@ doveadm_cmd_pass_reply_parse(struct doveadm_mail_cmd_context *ctx,
                        auth_socket_path, proxy_set->host);
                return -1;
        }
-
-       if (proxy_set->ssl_flags != 0)
-               ;
-       else if (strcmp(ctx->set->doveadm_ssl, "ssl") == 0)
-               proxy_set->ssl_flags |= AUTH_PROXY_SSL_FLAG_YES;
-       else if (strcmp(ctx->set->doveadm_ssl, "starttls") == 0) {
-               proxy_set->ssl_flags |= AUTH_PROXY_SSL_FLAG_YES |
-                       AUTH_PROXY_SSL_FLAG_STARTTLS;
-       }
        return 0;
 }