Hello community, here is the log from the commit of package imapfilter for openSUSE:Factory checked in at 2012-08-07 08:26:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/imapfilter (Old) and /work/SRC/openSUSE:Factory/.imapfilter.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "imapfilter", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/imapfilter/imapfilter.changes 2012-04-23 16:11:23.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.imapfilter.new/imapfilter.changes 2012-08-07 08:26:36.000000000 +0200 @@ -1,0 +2,8 @@ +Wed Jul 25 18:26:05 UTC 2012 - [email protected] + +- updated to version 2.5.3 + - New implementation for international mailbox names. + - Bug fix; wrong variable name in one of the examples on extending. + - Bug fix; an OpenSSL compilation warning. + +------------------------------------------------------------------- Old: ---- imapfilter-2.5.2.tar.gz New: ---- imapfilter-2.5.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ imapfilter.spec ++++++ --- /var/tmp/diff_new_pack.ftxJ4a/_old 2012-08-07 08:26:37.000000000 +0200 +++ /var/tmp/diff_new_pack.ftxJ4a/_new 2012-08-07 08:26:37.000000000 +0200 @@ -21,7 +21,7 @@ License: MIT Group: Productivity/Networking/Email/Utilities Url: https://github.com/lefcha/imapfilter -Version: 2.5.2 +Version: 2.5.3 Release: 0 Source: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ imapfilter-2.5.2.tar.gz -> imapfilter-2.5.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.2/NEWS new/imapfilter-2.5.3/NEWS --- old/imapfilter-2.5.2/NEWS 2012-02-29 21:20:34.000000000 +0100 +++ new/imapfilter-2.5.3/NEWS 2012-07-22 15:29:45.000000000 +0200 @@ -1,3 +1,8 @@ +IMAPFilter 2.5.3 - 22 Jul 2012 + - New implementation for international mailbox names. + - Bug fix; wrong variable name in one of the examples on extending. + - Bug fix; an OpenSSL compilation warning. + IMAPFilter 2.5.2 - 29 Feb 2012 - Persistent errors or connection failures are now ignored when running in daemon mode, and a reconnection is attempted during the next loop iteration. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.2/doc/imapfilter_config.5 new/imapfilter-2.5.3/doc/imapfilter_config.5 --- old/imapfilter-2.5.2/doc/imapfilter_config.5 2012-02-29 21:20:34.000000000 +0100 +++ new/imapfilter-2.5.3/doc/imapfilter_config.5 2012-07-22 15:29:45.000000000 +0200 @@ -1,4 +1,4 @@ -.Dd February 27, 2012 +.Dd April 25, 2012 .Dt IMAPFILTER_CONFIG 5 .Os .Sh NAME @@ -159,7 +159,7 @@ With this option it is possible to control the recovery functionality, which restores a session (the connection to the server and the IMAP state at the time), after some unexpected event takes place. Currently there are two types -of events that can close abnormally a session, and finally cause the program to +of events that can end abnormally a session, and finally cause the program to terminate: network errors, and the IMAP BYE response which a server can send anytime. When this option is set to .Dq all @@ -1258,7 +1258,7 @@ type. Note that due to Lua using backslash .Sq \e as an escape character for its strings, one has to double backslashes in order -to insert a single backslash inside a regular expression pattern: +to insert a single backslash inside a regular expression pattern. .El .Pp Examples: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.2/samples/extend.lua new/imapfilter-2.5.3/samples/extend.lua --- old/imapfilter-2.5.2/samples/extend.lua 2012-02-29 21:20:34.000000000 +0100 +++ new/imapfilter-2.5.3/samples/extend.lua 2012-07-22 15:29:45.000000000 +0200 @@ -77,7 +77,7 @@ all = myaccount.mymailbox:select_all() for _, mesg in ipairs(all) do - mbox, uid = table.unpack(all) + mbox, uid = table.unpack(mesg) header = mbox[uid]:fetch_header() body = mbox[uid]:fetch_body() message = header:gsub('[\r\n]+$', '\r\n') .. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.2/src/namespace.c new/imapfilter-2.5.3/src/namespace.c --- old/imapfilter-2.5.2/src/namespace.c 2012-02-29 21:20:34.000000000 +0100 +++ new/imapfilter-2.5.3/src/namespace.c 2012-07-22 15:29:45.000000000 +0200 @@ -1,6 +1,5 @@ #include <stdio.h> #include <string.h> -#include <iconv.h> #include <errno.h> #include "imapfilter.h" @@ -11,6 +10,10 @@ buffer cbuf; /* Conversion buffer. */ +static const char base64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; + + const char *apply_conversion(const char *mbox); const char *reverse_conversion(const char *mbox); @@ -95,113 +98,129 @@ const char * apply_conversion(const char *mbox) { - iconv_t cd; - char *inbuf, *outbuf; - size_t inlen, outlen; - char *c, *shift; - unsigned char *r, *w; + unsigned char *c, *out; + unsigned char ucp[4], ucplast, ucptemp; + int padding, shift; buffer_check(&nbuf, strlen(mbox)); buffer_reset(&nbuf); xstrncpy(nbuf.data, mbox, nbuf.size); nbuf.len = strlen(nbuf.data); - buffer_check(&cbuf, nbuf.len * 5); + buffer_check(&cbuf, nbuf.len * 4); buffer_reset(&cbuf); - r = (unsigned char *)nbuf.data; - w = (unsigned char *)cbuf.data; - inbuf = outbuf = NULL; - inlen = outlen = 0; - while (*r != '\0') { - /* Skip non-printable ASCII characters. */ - if (*r < 0x20 || *r == 0x7F) { - r++; + c = (unsigned char *)nbuf.data; + out = (unsigned char *)cbuf.data; + + memset((void *)ucp, 0, sizeof(ucp)); + ucplast = ucptemp = 0; + padding = shift = 0; + + while (*c != '\0' || shift > 0) { + if (shift > 0 && *c <= 0x7F) { + /* Last character so do Base64 padding. */ + if (padding == 2) { + *out++ = base64[ucplast << 2 & 0x3C]; + } else if (padding == 4) { + *out++ = base64[ucplast << 4 & 0x30]; + } + *out++ = '-'; + padding = 0; + shift = 0; continue; } + /* Escape shift character for modified UTF-7. */ - if (*r == '&') { - *w++ = '&'; - *w++ = '-'; - r++; + if (*c == '&') { + *out++ = '&'; + *out++ = '-'; + c++; continue; - } - /* Copy ASCII printable characters. */ - if (*r >= 0x20 && *r <= 0x7E) { - *w++ = *r++; + + /* Copy all ASCII printable characters. */ + } else if ((*c >= 0x20 && *c <= 0x7e)) { + *out++ = *c; + c++; continue; } - /* UTF-8 sequence will follow. */ - if (inbuf == NULL) { - inbuf = (char *)r; - inlen = 0; - } - if ((*r & 0xE0) == 0xC0) { /* Two byte UTF-8. */ - inlen += 2; - r += 2; - } else if ((*r & 0xF0) == 0xE0) { /* Three byte UTF-8. */ - inlen += 3; - r += 3; - } else if ((*r & 0xF8) == 0xF0) { /* Four byte UTF-8. */ - inlen += 4; - r += 4; - } - /* UTF-8 sequence has ended, convert it to UTF-7. */ - if (inbuf != NULL && (*r <= 0x7F || *r == '\0')) { - outbuf = (char *)w; - outlen = cbuf.size - (outbuf - cbuf.data); - - cd = iconv_open("UTF-7", ""); - if (cd == (iconv_t)-1) { - error("converting mailbox name; %s\n", - strerror(errno)); - return mbox; + + /* Non-ASCII UTF-8 characters follow. */ + if (shift == 0) + *out++ = '&'; + /* Convert UTF-8 characters to Unicode code point. */ + if ((*c & 0xE0) == 0xC0) { + shift = 2; + ucp[0] = 0x07 & *c >> 2; + ucp[1] = (*c << 6 & 0xC0) | (*(c + 1) & 0x3F); + c += 2; + } else if ((*c & 0xF0) == 0xE0) { + shift = 3; + ucp[0] = (*c << 4 & 0xF0) | (*(c + 1) >> 2 & 0x0F); + ucp[1] = (*(c + 1) << 6 & 0xC0) | (*(c + 2) & 0x3F); + c += 3; + } else if ((*c & 0xF8) == 0xF0) { + shift = 4; + ucptemp = ((*c << 2 & 0x1C) | (*(c + 1) >> 4 & 0x03)) - + 0x01; + ucp[0] = (ucptemp >> 2 & 0x03) | 0xD8; + ucp[1] = (ucptemp << 6 & 0xC0) | + (*(c + 1) << 2 & 0x3C) | (*(c + 2) >> 4 & 0x03); + ucp[2] = (*(c + 2) >> 2 & 0x03) | 0xDC; + ucp[3] = (*(c + 2) << 6 & 0xC0) | (*(c + 3) & 0x3F); + c += 4; + } + + /* Convert Unicode characters to UTF-7. */ + if (padding == 0) { + *out++ = base64[ucp[0] >> 2 & 0x3F]; + *out++ = base64[(ucp[0] << 4 & 0x30) | + (ucp[1] >> 4 & 0x0F)]; + if (shift == 4) { + ucplast = ucp[3]; + *out++ = base64[(ucp[1] << 2 & 0x3C) | + (ucp[2] >> 6 & 0x03)]; + *out++ = base64[ucp[2] & 0x3F]; + *out++ = base64[ucp[3] >> 2 & 0x3F]; + padding = 4; + } else { + ucplast = ucp[1]; + padding = 2; } - while (inlen > 0) { - if (iconv(cd, &inbuf, &inlen, &outbuf, &outlen) - == -1) { - if (errno == E2BIG) { - buffer_check(&cbuf, cbuf.size * - 2); - break; - } else { - error("converting mailbox name;" - "%s\n", strerror(errno)); - return mbox; - } - } else { - iconv(cd, NULL, NULL, &outbuf, &outlen); - } + } else if (padding == 2) { + *out++ = base64[(ucplast << 2 & 0x3C) | + (ucp[0] >> 6 & 0x03)]; + *out++ = base64[ucp[0] & 0x3F]; + *out++ = base64[ucp[1] >> 2 & 0x3F]; + if (shift == 4) { + *out++ = base64[(ucp[1] << 4 & 0x30) | + (ucp[2] >> 4 & 0x0F)]; + *out++ = base64[(ucp[2] << 2 & 0x3C) | + (ucp[3] >> 6 & 0x03)]; + *out++ = base64[ucp[3] & 0x3F]; + padding = 0; + } else { + ucplast = ucp[1]; + padding = 4; + } + } else if (padding == 4) { + *out++ = base64[(ucplast << 4 & 0x30) | + (ucp[0] >> 4 & 0x0F)]; + *out++ = base64[(ucp[0] << 2 & 0x3C) | + (ucp[1] >> 6 & 0x03)]; + if (shift == 4) { + ucplast = ucp[3]; + *out++ = base64[ucp[1] & 0x3F]; + *out++ = base64[ucp[2] >> 2 & 0x3F]; + *out++ = base64[(ucp[2] << 4 & 0x30) | + (ucp[3] >> 4 & 0x0F)]; + padding = 2; + } else { + *out++ = base64[ucp[1] & 0x3F]; + padding = 0; } - iconv_close(cd); - - w = (unsigned char *)outbuf; - inbuf = outbuf = NULL; - inlen = outlen = 0; - } - } - - if (*w != '\0') - *w = '\0'; - - /* Convert UTF-7 sequences to IMAP modified UTF-7. */ - for (c = cbuf.data, shift = NULL; *c != '\0'; c++) - switch (*c) { - case '+': - *c = '&'; - shift = c; - break; - case '-': - shift = NULL; - break; - case '/': - if (shift != NULL) - *c = ','; - break; } - if (shift != NULL) { - *w++ = '-'; - *w = '\0'; } + *out = '\0'; debug("conversion: '%s' -> '%s'\n", nbuf.data, cbuf.data); @@ -215,81 +234,143 @@ const char * reverse_conversion(const char *mbox) { - iconv_t cd; - char *inbuf, *outbuf; - size_t inlen, outlen; - char *c, *shift; + unsigned char *c, *out; + unsigned char ucp[4], ucptemp; + unsigned char b64[6], b64last; + int padding; buffer_check(&cbuf, strlen(mbox)); buffer_reset(&cbuf); xstrncpy(cbuf.data, mbox, cbuf.size); + cbuf.len = strlen(cbuf.data); + buffer_check(&nbuf, cbuf.len); + buffer_reset(&nbuf); + + c = (unsigned char *)cbuf.data; + out = (unsigned char *)nbuf.data; - /* Convert IMAP modified UTF-7 sequences to UTF-7. */ - for (c = cbuf.data, shift = NULL; *c != '\0'; c++) - switch (*c) { - case '&': - *c = '+'; - shift = c; - break; - case '-': - shift = NULL; - break; - case ',': - if (shift != NULL) - *c = '/'; - break; + memset((void *)ucp, 0, sizeof(ucp)); + memset((void *)b64, 0, sizeof(b64)); + ucptemp = b64last = 0; + padding = 0; + + while (*c != '\0') { + /* Copy all ASCII printable characters. */ + if (*c >= 0x20 && *c <= 0x7e) { + if (*c != '&') { + *out++ = *c++; + continue; + } else { + c++; + } } - do { - inbuf = cbuf.data; - inlen = strlen(cbuf.data); - - buffer_check(&nbuf, inlen); - buffer_reset(&nbuf); - - outbuf = nbuf.data; - outlen = nbuf.size; - - cd = iconv_open("", "UTF-7"); - if (cd == (iconv_t)-1) { - error("converting mailbox name; %s\n", strerror(errno)); - return mbox; + /* Write shift character for modified UTF-7. */ + if (*c == '-') { + *out++ = '&'; + c++; + continue; } - while (inlen > 0) { - if (iconv(cd, &inbuf, &inlen, &outbuf, &outlen) == -1) { - if (errno == E2BIG) { - buffer_check(&nbuf, nbuf.size * 2); - break; - } else { - error("converting mailbox name; %s\n", - strerror(errno)); - return mbox; - } + + /* UTF-7 characters follow. */ + padding = 0; + do { + /* Read Base64 characters. */ + b64[0] = strchr(base64, *c) - base64; + b64[1] = strchr(base64, *(c + 1)) - base64; + if (padding == 0 || padding == 2) { + b64[2] = strchr(base64, *(c + 2)) - base64; + c += 3; } else { - iconv(cd, NULL, NULL, &outbuf, &outlen); + c += 2; + } + /* Convert from Base64 to Unicode code point. */ + if (padding == 0) { + ucp[0] = (b64[0] << 2 & 0xFC) | + (b64[1] >> 4 & 0x03); + ucp[1] = (b64[1] << 4 & 0xF0) | + (b64[2] >> 2 & 0x0F); + b64last = b64[2]; + padding = 2; + } else if (padding == 2) { + ucp[0] = (b64last << 6 & 0xC0) | + (b64[0] & 0x3F); + ucp[1] = (b64[1] << 2 & 0xFC) | + (b64[2] >> 4 & 0x03); + b64last = b64[2]; + padding = 4; + } else if (padding == 4) { + ucp[0] = (b64last << 4 & 0xF0) | + (b64[0] >> 2 & 0x0F); + ucp[1] = (b64[0] << 6 & 0xC0) | + (b64[1] & 0x3F); + padding = 0; } - } - iconv_close(cd); - } while (inlen > 0); - *outbuf = '\0'; - for (c = nbuf.data; (c = strchr(c,'+')) != NULL; *c = '&'); + /* Convert from Unicode to UTF-8. */ + if (ucp[0] >= 0x00 && ucp[0] <= 0x07) { + *out++ = 0xC0 | (ucp[0] << 2 & 0x1C) | + (ucp[1] >> 6 & 0x03); + *out++ = 0x80 | (ucp[1] & 0x3F); + } else if ((ucp[0] >= 0x08 && ucp[0] <= 0xD7) || + (ucp[0] >= 0xE0 && ucp[0] <= 0xFF)) { + *out++ = 0xE0 | (ucp[0] >> 4 & 0x0F); + *out++ = 0x80 | (ucp[0] << 2 & 0x1C) | + (ucp[1] >> 6 & 0x03); + *out++ = 0x80 | (ucp[1] & 0x3F); + } else if (ucp[0] >= 0xD8 && ucp[0] <= 0xDF) { + b64[3] = strchr(base64, *c) - base64; + b64[4] = strchr(base64, *(c + 1)) - base64; + if (padding == 0 || padding == 2) { + b64[5] = strchr(base64, *(c + 2)) - + base64; + c += 3; + } else { + c += 2; + } - /* Convert UTF-7 sequences to IMAP modified UTF-7. */ - for (c = cbuf.data, shift = NULL; *c != '\0'; c++) - switch (*c) { - case '+': - *c = '&'; - shift = c; - break; - case '-': - shift = NULL; - break; - case '/': - if (shift != NULL) - *c = ','; - break; - } + if (padding == 0) { + ucp[2] = (b64[3] << 2 & 0xFC) | + (b64[4] >> 4 & 0x03); + ucp[3] = (b64[4] << 4 & 0xF0) | + (b64[5] >> 2 & 0x0F); + b64last = b64[5]; + padding = 2; + } else if (padding == 2) { + ucp[2] = (b64last << 6 & 0xC0) | + (b64[3] & 0x3F); + ucp[3] = (b64[4] << 2 & 0xFC) | + (b64[5] >> 4 & 0x03); + b64last = b64[5]; + padding = 4; + } else if (padding == 4) { + ucp[2] = (b64last << 4 & 0xF0) | + (b64[3] >> 2 & 0x0F); + ucp[3] = (b64[3] << 6 & 0xC0) | + (b64[4] & 0x3F); + padding = 0; + } + + ucp[0] &= 0xFF - 0xDF; + ucptemp = ((ucp[0] << 2 & 0x0C) | + (ucp[1] >> 6 & 0x03)) + 0x1; + ucp[2] &= 0xFF - 0xDC; + + *out++ = 0xF0 | (ucptemp >> 2 & 0x03); + *out++ = 0x80 | (ucptemp << 4 & 0x30) | + (ucp[1] >> 2 & 0x0F); + *out++ = 0x80 | (ucp[1] << 4 & 0x30) | + (ucp[2] << 2 & 0x0C) | + (ucp[3] >> 6 & 0x03); + *out++ = 0x80 | (ucp[3] & 0x3F); + } + if (*c == '-') { + c++; + break; + } + } while (*c != '-'); + } + *out = '\0'; debug("conversion: '%s' <- '%s'\n", nbuf.data, cbuf.data); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.2/src/socket.c new/imapfilter-2.5.3/src/socket.c --- old/imapfilter-2.5.2/src/socket.c 2012-02-29 21:20:34.000000000 +0100 +++ new/imapfilter-2.5.3/src/socket.c 2012-07-22 15:29:45.000000000 +0200 @@ -85,7 +85,11 @@ { int r, e; SSL_CTX *ctx; +#if OPENSSL_VERSION_NUMBER >= 0x1000000fL const SSL_METHOD *method; +#else + SSL_METHOD *method; +#endif method = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.2/src/version.h new/imapfilter-2.5.3/src/version.h --- old/imapfilter-2.5.2/src/version.h 2012-02-29 21:20:34.000000000 +0100 +++ new/imapfilter-2.5.3/src/version.h 2012-07-22 15:29:45.000000000 +0200 @@ -3,7 +3,7 @@ /* Program's version number. */ -#define VERSION "2.5.2" +#define VERSION "2.5.3" /* Program's copyright. */ #define COPYRIGHT "Copyright (c) 2001-2012 Eleftherios Chatzimparmpas" -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
