From: Aki Tuomi Date: Mon, 16 Dec 2024 10:53:23 +0000 (+0200) Subject: imap-hibernate: Add local and remote port as variables to mail_log_prefix X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c8a009249d033834196c46ef30ef95865ef34482;p=thirdparty%2Fdovecot%2Fcore.git imap-hibernate: Add local and remote port as variables to mail_log_prefix --- diff --git a/src/imap-hibernate/imap-client.c b/src/imap-hibernate/imap-client.c index fa5eddef30..5e72c50ee5 100644 --- a/src/imap-hibernate/imap-client.c +++ b/src/imap-hibernate/imap-client.c @@ -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 }