From: Art Cancro Date: Thu, 9 Mar 2017 15:29:02 +0000 (-0500) Subject: Try POP3S first, then POP3 if it fails. Always ignore the certificate because that... X-Git-Tag: v939~604^2~5 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=852008e87cf586e0d067c50b390da1870b033dd0 Try POP3S first, then POP3 if it fails. Always ignore the certificate because that's a false sense of security and I don't feel like adding the complexity required to make the user specify their preference on every single connection. Also ran some tests to confirm that once libcurl opens a POP3 connection it stays open for the remaining commands, which is good because we don't want the message numbers to get out of sequence. --- diff --git a/citadel/modules/pop3client/serv_pop3client.c b/citadel/modules/pop3client/serv_pop3client.c index 658644d57..df8a4addc 100644 --- a/citadel/modules/pop3client/serv_pop3client.c +++ b/citadel/modules/pop3client/serv_pop3client.c @@ -77,7 +77,6 @@ void pop3client_one_mailbox(struct ctdlroom *qrbuf, const char *host, const char char url[SIZ]; CURL *curl; CURLcode res = CURLE_OK; - int is_pop3s = 0; curl = curl_easy_init(); if (!curl) { @@ -96,7 +95,6 @@ void pop3client_one_mailbox(struct ctdlroom *qrbuf, const char *host, const char curl_easy_setopt(curl, CURLOPT_URL, url); res = curl_easy_perform(curl); if (res == CURLE_OK) { - is_pop3s = 1; } else { syslog(LOG_DEBUG, "POP3S client failed: %s , trying POP3 next", curl_easy_strerror(res)); snprintf(url, sizeof url, "pop3://%s", host); // try unencrypted next @@ -110,7 +108,16 @@ void pop3client_one_mailbox(struct ctdlroom *qrbuf, const char *host, const char return; } - // FIXME finish this + // If we got this far, a connection was established, we know whether it's pop3s or pop3, and UIDL is supported. + + + // FIXME write the rest ... all this crap was just a test to make sure libcurl is holding open a single connection. + curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "RETR 1"); + res = curl_easy_perform(curl); + curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "UIDL"); + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); return;