]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-hibernate: Add local and remote port as variables to mail_log_prefix
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 16 Dec 2024 10:53:23 +0000 (12:53 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 18 Dec 2024 07:26:31 +0000 (09:26 +0200)
src/imap-hibernate/imap-client.c

index fa5eddef308870647b63dba9731a7e9ff87ed227..5e72c50ee5eba814d2b1abb6b1a64e785cbe0002 100644 (file)
@@ -511,6 +511,15 @@ imap_client_get_var_expand_table(struct imap_client *client)
                auth_domain = i_strchr_to_next(auth_user, '@');
        }
 
+
+       const char *local_port = "";
+       const char *remote_port = "";
+
+       if (client->state.local_port != 0)
+               local_port = dec2str(client->state.local_port);
+       if (client->state.remote_port != 0)
+               remote_port = dec2str(client->state.remote_port);
+
        const struct var_expand_table stack_tab[] = {
                { 'u', client->state.username, "user" },
                { 'n', username, "username" },
@@ -519,6 +528,8 @@ imap_client_get_var_expand_table(struct imap_client *client)
                { 'h', NULL /* we shouldn't need this */, "home" },
                { 'l', local_ip, "lip" },
                { 'r', remote_ip, "rip" },
+               { 'a', local_port, "lport" },
+               { 'a', remote_port, "rport" },
                { 'p', my_pid, "pid" },
                { 'i', dec2str(client->state.uid), "uid" },
                { '\0', dec2str(client->state.gid), "gid" },
@@ -529,6 +540,8 @@ imap_client_get_var_expand_table(struct imap_client *client)
                /* aliases: */
                { '\0', local_ip, "local_ip" },
                { '\0', remote_ip, "remote_ip" },
+               { '\0', local_port, "local_port" },
+               { '\0', remote_port, "remote_port" },
                /* NOTE: keep this synced with lib-storage's
                   mail_user_var_expand_table() */
                { '\0', NULL, NULL }