]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
submission-login: Only overwrite XCLIENT fields in the client when a value is assigned.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 13 Feb 2019 21:21:21 +0000 (22:21 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 21 Mar 2019 08:02:51 +0000 (10:02 +0200)
Before, omitted fields in the XCLIENT command would cause the values in the
client to be reset to the equivalent of zero.

src/submission-login/client.c

index 11e8429307ad5aee101ceb27da83be3e7a2c56c7..3e45e556c7f35afee339508e4ddbf805ebc901ba 100644 (file)
@@ -174,10 +174,12 @@ client_connection_cmd_xclient(void *context,
 
        struct submission_client *client = context;
 
-       client->common.ip = data->source_ip;
-       client->common.remote_port = data->source_port;
-
-       client->common.proxy_ttl = data->ttl_plus_1;
+       if (data->source_ip.family != 0)
+               client->common.ip = data->source_ip;
+       if (data->source_port != 0)
+               client->common.remote_port = data->source_port;
+       if (data->ttl_plus_1 > 0)
+               client->common.proxy_ttl = data->ttl_plus_1 - 1;
 
        for (i = 0; i < data->extra_fields_count; i++) {
                const char *name = data->extra_fields[i].name;