From: Christopher Faulet Date: Tue, 27 Mar 2018 13:35:35 +0000 (+0200) Subject: BUG/MINOR: email-alert: Set the mailer port during alert initialization X-Git-Tag: v1.9-dev1~325 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b797ae1f15b0fb97d1ae8550d37c3fd58a24f5b3;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/checks.c b/src/checks.c index 8e4bc2ccf1..80a9c70d2a 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) {