From 5b22b38daf3f94eadfa0667ae799bcd0f9ee40b9 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Thu, 26 Aug 2021 23:53:14 +0200 Subject: sanity check well-known POP3/IMAP ports vs. SSL Gitlab: Closes #31. (cherry picked from commit da6eb347af326912560f56081d603a0a78c3d56d) --- fetchmail.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'fetchmail.c') diff --git a/fetchmail.c b/fetchmail.c index 6ca9db94..ddac95df 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -1412,6 +1412,16 @@ static int load_params(int argc, char **argv, int optind) ctl->server.pollname); exit(PS_SYNTAX); } + switch (ctl->server.protocol) { + case P_POP3: case P_APOP: + if (port == 995 && !ctl->use_ssl) report(stderr, GT_("WARNING: %s configuration invalid, you normally need --ssl for port 995/service pop3s.\n"), ctl->server.pollname); + if (port == 110 && ctl->use_ssl) report(stderr, GT_("WARNING: %s configuration invalid, you should normally omit --ssl for port 110/service pop3.\n"), ctl->server.pollname); + break; + case P_IMAP: + if (port == 993 && !ctl->use_ssl) report(stderr, GT_("WARNING: %s configuration invalid, you normally need --ssl for port 993/service imaps.\n"), ctl->server.pollname); + if (port == 143 && ctl->use_ssl) report(stderr, GT_("WARNING: %s configuration invalid, you should normally omit --ssl for port 143/service imap.\n"), ctl->server.pollname); + break; + } } if (ctl->listener == LMTP_MODE) { -- cgit v1.2.3