Hi,
This patch fixes an issue about email alerts reported by Johan. It must
be backported in 1.8.
Johan, could you confirm it fixes the bug ?
Thanks
--
Christopher Faulet
>From c3ece0fff609ea2eb47445f331a66cd3ed096ef1 Mon Sep 17 00:00:00 2001
From: Christopher Faulet <[email protected]>
Date: Tue, 27 Mar 2018 15:35:35 +0200
Subject: [PATCH] BUG/MINOR: email-alert: Set the mailer port during alert
initialization
Since the commit 2f3a56b4f ("BUG/MINOR: tcp-check: use the server's service port
as a fallback"), email alerts stopped working because the mailer's port was
overriden by the server's port. Remember, email alerts are defined as checks
with specific tcp-check rules and triggered on demand to send alerts. So to send
an email, a check is executed. Because no specific port's was defined, the
server's one was used.
To fix the bug, the ports used for checks attached an email alert are explicitly
set using the mailer's port. So this port will be used instead of the server's
one.
In this patch, the assignement to a default port (587) when an email alert is
defined has been removed. Indeed, when a mailer is defined, the port must be
defined. So the default port was never used.
This patch must be backported in 1.8.
---
src/checks.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/checks.c b/src/checks.c
index cae2e3e3..ea95af85 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -3202,9 +3202,7 @@ int init_email_alert(struct mailers *mls, struct proxy *p, char **err)
check->xprt = mailer->xprt;
check->addr = mailer->addr;
- if (!get_host_port(&mailer->addr))
- /* Default to submission port */
- check->port = 587;
+ check->port = get_host_port(&mailer->addr);
//check->server = s;
if ((t = task_new(MAX_THREADS_MASK)) == NULL) {
--
2.14.3