From 684e3a06c4d2ab35e39760f328a0d354ad330622 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 23 Mar 2017 21:15:22 -0400 Subject: [PATCH] If the administrator specifies a smart-host as an smtp:// or smtps:// URI, allow that. --- citadel/modules/rssclient/serv_rssclient.c | 2 ++ citadel/modules/smtp/serv_smtpclient.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/citadel/modules/rssclient/serv_rssclient.c b/citadel/modules/rssclient/serv_rssclient.c index b7cd89ef3..72ce11ed2 100644 --- a/citadel/modules/rssclient/serv_rssclient.c +++ b/citadel/modules/rssclient/serv_rssclient.c @@ -350,6 +350,8 @@ void rss_pull_one_feed(struct rssurl *url) Downloaded = NewStrBuf(); curl_easy_setopt(curl, CURLOPT_URL, url->url); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); // Follow redirects curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlFillStrBuf_callback); // What to do with downloaded data curl_easy_setopt(curl, CURLOPT_WRITEDATA, Downloaded); // Give it our StrBuf to work with diff --git a/citadel/modules/smtp/serv_smtpclient.c b/citadel/modules/smtp/serv_smtpclient.c index fcf74e9ee..48c761dc4 100644 --- a/citadel/modules/smtp/serv_smtpclient.c +++ b/citadel/modules/smtp/serv_smtpclient.c @@ -236,9 +236,19 @@ int smtp_attempt_delivery(long msgid, char *recp, char *envelope_from) curl_easy_setopt(curl, CURLOPT_READDATA, &s); curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); // tell libcurl we are uploading curl_easy_setopt(curl, CURLOPT_TIMEOUT, 20L); // Time out after 20 seconds + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); strcpy(try_this_mx, "smtp://"); extract_token(&try_this_mx[7], mxes, i, '|', (sizeof try_this_mx - 7)); + if ( + (!strncasecmp(try_this_mx, HKEY("smtp://smtp://"))) // This can happen if the administrator + || (!strncasecmp(try_this_mx, HKEY("smtp://smtps://"))) // puts a full smtp[s] URI as the smart-host + ) { + strcpy(try_this_mx, &try_this_mx[7]); + } + + curl_easy_setopt(curl, CURLOPT_URL, try_this_mx); syslog(LOG_DEBUG, "smtpclient: trying %s", try_this_mx); // send the message -- 2.30.2