]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
submission-login: Only send HELO domain to post-login service when it is valid.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 7 Mar 2018 14:14:52 +0000 (15:14 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 13 Mar 2018 04:25:16 +0000 (06:25 +0200)
src/submission-login/client-authenticate.c

index 6d062096a77bd45c807901572bd9aed68a0027c3..190fa73fa032d82374bea1cd81cc35a7257c6d12 100644 (file)
@@ -255,17 +255,19 @@ int cmd_auth(void *conn_ctx, struct smtp_server_cmd_ctx *cmd,
        struct submission_client *subm_client = conn_ctx;
        struct client *client = &subm_client->common;
        struct smtp_server_helo_data *helo;
-       char *prefix;
+       const char *prefix = "";
 
        i_assert(subm_client->pending_auth == NULL);
 
        helo = smtp_server_connection_get_helo_data(subm_client->conn);
-
-       prefix = i_strdup(helo->domain == NULL ? "" : helo->domain);
+       if (helo->domain_valid) {
+               i_assert(helo->domain != NULL);
+               prefix = helo->domain;
+       }
 
        /* pass ehlo parameter to post-login service upon successful login */
        i_free(client->master_data_prefix);
-       client->master_data_prefix = (void *)prefix;
+       client->master_data_prefix = (void *)i_strdup(prefix);
        client->master_data_prefix_len = strlen(prefix) + 1;
 
        subm_client->pending_auth = cmd;