]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Fix segfault occurring in client_read_settings().
authorStephan Bosch <stephan.bosch@dovecot.fi>
Mon, 11 Dec 2017 14:55:32 +0000 (15:55 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Mon, 11 Dec 2017 14:55:32 +0000 (15:55 +0100)
This problem is caused by recent changes.
The code attempts to access client->conn to obtain connection security info, which is not yet assigned at that point.
It is doubtful whether assigning those security flags is useful at that stage, but it now uses the ssl flag from the master_service_connection instead.

src/lmtp/client.c

index ba9acdca0418de34026ce9f4e89d7701a586dad5..b7b2eb0481b9de582bb3892e4bf4ba1f7c89a64c 100644 (file)
@@ -87,7 +87,7 @@ static void client_raw_user_create(struct client *client)
                raw_storage_create_from_set(client->user_set_info, sets[0]);
 }
 
-static void client_read_settings(struct client *client)
+static void client_read_settings(struct client *client, bool ssl)
 {
        struct mail_storage_service_input input;
        const struct setting_parser_context *set_parser;
@@ -101,11 +101,9 @@ static void client_read_settings(struct client *client)
        input.remote_ip = client->remote_ip;
        input.local_port = client->local_port;
        input.remote_port = client->remote_port;
+       input.conn_secured = ssl;
+       input.conn_ssl_secured = ssl;
        input.username = "";
-       input.conn_ssl_secured =
-               smtp_server_connection_is_ssl_secured(client->conn);
-       input.conn_secured = input.conn_ssl_secured ||
-               smtp_server_connection_is_trusted(client->conn);
 
        if (mail_storage_service_read_settings(storage_service, &input,
                                               client->pool,
@@ -138,10 +136,9 @@ struct client *client_create(int fd_in, int fd_out,
        client->remote_port = conn->remote_port;
        client->local_ip = conn->local_ip;
        client->local_port = conn->local_port;
-
        client->state_pool = pool_alloconly_create("client state", 4096);
 
-       client_read_settings(client);
+       client_read_settings(client, conn->ssl);
        client_raw_user_create(client);
        client->my_domain = client->unexpanded_lda_set->hostname;