]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
submission: submission-client - Immediately terminate connection when it is an anonym...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 9 Aug 2019 21:13:43 +0000 (23:13 +0200)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 13 Aug 2019 22:46:26 +0000 (00:46 +0200)
Unless a plugin flags the client for allowed anonymous login.

src/submission/submission-client.c
src/submission/submission-client.h

index b0d3c045efea833192c209cfd6cd5c4eae44d724..4c7537f96465a791e5f3b8b94b7244aaf86ea81f 100644 (file)
@@ -247,14 +247,6 @@ struct client *client_create(int fd_in, int fd_out,
 
        client_create_backend_default(client, set);
 
-       if (client->backend_capabilities_configured) {
-               client_apply_backend_capabilities(client);
-               smtp_server_connection_start(client->conn);
-       } else {
-               submission_backend_start(client->backend_default);
-               smtp_server_connection_start_pending(client->conn);
-       }
-
        mail_set = mail_user_set_get_storage_set(user);
        if (*set->imap_urlauth_host != '\0' &&
            *mail_set->mail_attribute_dict != '\0') {
@@ -277,6 +269,18 @@ struct client *client_create(int fd_in, int fd_out,
        if (hook_client_created != NULL)
                hook_client_created(&client);
 
+       if (user->anonymous && !client->anonymous_allowed) {
+               smtp_server_connection_abort(
+                       &client->conn, 534, "5.7.9",
+                       "Anonymous login is not allowed for submission");
+       } else if (client->backend_capabilities_configured) {
+               client_apply_backend_capabilities(client);
+               smtp_server_connection_start(client->conn);
+       } else {
+               submission_backend_start(client->backend_default);
+               smtp_server_connection_start_pending(client->conn);
+       }
+
        submission_refresh_proctitle();
        return client;
 }
index 2455d2ee386ea4c464d6f841457096c8f08e08cc..18007892daac533126aefdb220af8a1cbf2441cf 100644 (file)
@@ -116,6 +116,7 @@ struct client {
        bool destroyed:1;
        bool anvil_sent:1;
        bool backend_capabilities_configured:1;
+       bool anonymous_allowed:1;
 };
 
 struct submission_module_register {