From ebf669cdbf7854f03113a937605658f100aefd48 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Fri, 9 Oct 2015 16:04:25 +0200 Subject: updated libquickmail to 0.1.20 --- 3rdParty/libquickmail/quickmail.c | 24 ++++++++++++------------ 3rdParty/libquickmail/quickmailprog.c | 12 ++++++++---- TODOS | 3 ++- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/3rdParty/libquickmail/quickmail.c b/3rdParty/libquickmail/quickmail.c index 249eeee..d6827ff 100644 --- a/3rdParty/libquickmail/quickmail.c +++ b/3rdParty/libquickmail/quickmail.c @@ -41,7 +41,7 @@ #define LIBQUICKMAIL_VERSION_MAJOR 0 #define LIBQUICKMAIL_VERSION_MINOR 1 -#define LIBQUICKMAIL_VERSION_MICRO 19 +#define LIBQUICKMAIL_VERSION_MICRO 20 #define VERSION_STRINGIZE_(major, minor, micro) #major"."#minor"."#micro #define VERSION_STRINGIZE(major, minor, micro) VERSION_STRINGIZE_(major, minor, micro) @@ -529,6 +529,7 @@ DLL_EXPORT_LIBQUICKMAIL char* quickmail_get_body (quickmail mailobj) do { if ((p = (char*)realloc(result, resultlen + BODY_BUFFER_SIZE)) == NULL) { free(result); + result = NULL; DEBUG_ERROR(ERRMSG_MEMORY_ALLOCATION_ERROR) break; } @@ -646,26 +647,25 @@ DLL_EXPORT_LIBQUICKMAIL size_t quickmail_get_data (void* ptr, size_t size, size_ char* s; //generate header part char** p = &mailobj->buf; - mailobj->buf = NULL; str_append(p, "User-Agent: libquickmail v" LIBQUICKMAIL_VERSION NEWLINE); if (mailobj->timestamp != 0) { char timestamptext[32]; - if (strftime(timestamptext, sizeof(timestamptext), "%a, %d %b %Y %H:%M:%S %z", localtime(&mailobj->timestamp))) { + if (strftime(timestamptext, sizeof(timestamptext), "%a, %d %b %Y %H:%M:%S %z", localtime(&mailobj->timestamp))) { str_append(p, "Date: "); str_append(p, timestamptext); str_append(p, NEWLINE); } -#ifdef _WIN32 +#ifdef _WIN32 //fallback method for Windows when %z (time zone offset) fails - else if (strftime(timestamptext, sizeof(timestamptext), "%a, %d %b %Y %H:%M:%S", localtime(&mailobj->timestamp))) { - TIME_ZONE_INFORMATION tzinfo; - if (GetTimeZoneInformation(&tzinfo) != TIME_ZONE_ID_INVALID) - sprintf(timestamptext + strlen(timestamptext), " %c%02i%02i", (tzinfo.Bias > 0 ? '-' : '+'), (int)-tzinfo.Bias / 60, (int)-tzinfo.Bias % 60); + else if (strftime(timestamptext, sizeof(timestamptext), "%a, %d %b %Y %H:%M:%S", localtime(&mailobj->timestamp))) { + TIME_ZONE_INFORMATION tzinfo; + if (GetTimeZoneInformation(&tzinfo) != TIME_ZONE_ID_INVALID) + sprintf(timestamptext + strlen(timestamptext), " %c%02i%02i", (tzinfo.Bias > 0 ? '-' : '+'), (int)-tzinfo.Bias / 60, (int)-tzinfo.Bias % 60); str_append(p, "Date: "); str_append(p, timestamptext); str_append(p, NEWLINE); } -#endif +#endif } if (mailobj->from && *mailobj->from) { str_append(p, "From: <"); @@ -709,7 +709,7 @@ DLL_EXPORT_LIBQUICKMAIL size_t quickmail_get_data (void* ptr, size_t size, size_ str_append(p, mailobj->mime_boundary_body); str_append(p, NEWLINE); } - mailobj->buflen = strlen(mailobj->buf); + mailobj->buflen = (mailobj->buf ? strlen(mailobj->buf) : 0); mailobj->current++; } if (mailobj->buflen == 0 && mailobj->current == MAILPART_BODY) { @@ -737,7 +737,7 @@ DLL_EXPORT_LIBQUICKMAIL size_t quickmail_get_data (void* ptr, size_t size, size_ mailobj->buf = str_append(&mailobj->buf, "Content-Type: "); mailobj->buf = str_append(&mailobj->buf, (mailobj->bodylist && mailobj->current_attachment->filename ? mailobj->current_attachment->filename : default_mime_type)); mailobj->buf = str_append(&mailobj->buf, NEWLINE "Content-Transfer-Encoding: 8bit" NEWLINE "Content-Disposition: inline" NEWLINE NEWLINE); - mailobj->buflen = strlen(mailobj->buf); + mailobj->buflen = (mailobj->buf ? strlen(mailobj->buf) : 0); } } if (mailobj->buflen == 0 && mailobj->current_attachment && mailobj->current_attachment->handle) { @@ -973,7 +973,7 @@ DLL_EXPORT_LIBQUICKMAIL const char* quickmail_send (quickmail mailobj, const cha curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); //set callback function for getting message body curl_easy_setopt(curl, CURLOPT_READFUNCTION, quickmail_get_data); - curl_easy_setopt(curl, CURLOPT_READDATA, mailobj); + curl_easy_setopt(curl, CURLOPT_READDATA, mailobj); curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); //set CURLOPT_UPLOAD to 1 to not use VRFY and other unneeded commands //enable debugging if requested if (mailobj->debuglog) { diff --git a/3rdParty/libquickmail/quickmailprog.c b/3rdParty/libquickmail/quickmailprog.c index f15f52f..c47bed9 100644 --- a/3rdParty/libquickmail/quickmailprog.c +++ b/3rdParty/libquickmail/quickmailprog.c @@ -59,7 +59,11 @@ void show_help() { printf( - "Usage: quickmail {-h server | -o filename} [-p port] [-u username] [-w password] -f email [-t email] [-c email] [-b email] [-s subject] [-m mimetype] [-d body] [-a file] [-v]\n" \ + "Usage: quickmail" +#ifdef NOCURL + "light" +#endif + " {-h server | -o filename} [-p port] [-u username] [-w password] -f email [-t email] [-c email] [-b email] [-s subject] [-m mimetype] [-d body] [-a file] [-v]\n" \ "Parameters:\n" \ " -h server \thostname or IP address of SMTP server\n" \ " -o filename \tname of file to dump the mail content to (- for stdout)\n" \ @@ -99,9 +103,9 @@ int main (int argc, char *argv[]) //show version #ifdef NOCURL printf("quickmail %s\n", quickmail_get_version()); -#else - { - curl_version_info_data* curlversion = curl_version_info(CURLVERSION_NOW); +#else + { + curl_version_info_data* curlversion = curl_version_info(CURLVERSION_NOW); printf("quickmail %s (with libcurl %s)\n", quickmail_get_version(), (curlversion ? curlversion->version : curl_version())); } #endif diff --git a/TODOS b/TODOS index af835f2..b98227c 100644 --- a/TODOS +++ b/TODOS @@ -8,4 +8,5 @@ - http://www.techrepublic.com/article/two-ways-to-design-a-database-for-a-net-based-cms/ - try to use the template mechanism for email in plain text and HTML, the renderer should be callable outside the HTTP response mechanism - +- start up only if tables are instanciated and fit the schema epoch + in the code (see bacula) -- cgit v1.2.3-54-g00ecf