- Add SMARTDATE patch.

- Fix MAILDIR_HEADER_CACHE if IMAP_HEADER_CACHE is not set
- Add options to disable TLS versions 1.1 and 1.2 if OPENSSL >= 1.0.0 is used (taken from upstream)
- Fix broken link in package description
- Bumped PORTREVISION

PR:		181431, 181319
Submitted by:	Udo Schweigert <udo.schweigert@siemens.com> (maintainer)
This commit is contained in:
amdmi3
2013-08-30 15:14:26 +00:00
parent abd7e0761e
commit fd1f733972
4 changed files with 249 additions and 5 deletions
+10 -4
View File
@@ -9,7 +9,7 @@
PORTNAME= mutt
PORTVERSION= 1.5.21
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES+= mail ipv6
MASTER_SITES= ftp://ftp.mutt.org/mutt/devel/ \
ftp://ftp.fu-berlin.de/pub/unix/mail/mutt/devel/ \
@@ -66,8 +66,8 @@ OPTIONS_DEFINE= COMPRESSED_FOLDERS SASL DEBUG FLOCK \
MAILDIR_HEADER_CACHE MAILDIR_MTIME_PATCH \
NNTP PARENT_CHILD_MATCH_PATCH \
QUOTE_PATCH REVERSE_REPLY_PATCH SGMLFORMAT SIDEBAR_PATCH \
SIGNATURE_MENU SMIME_OUTLOOK_COMPAT SMTP TOKYOCABINET \
TRASH_PATCH XML
SIGNATURE_MENU SMART_DATE SMIME_OUTLOOK_COMPAT SMTP \
TOKYOCABINET TRASH_PATCH XML
OPTIONS_SINGLE= SCREEN
OPTIONS_RADIO= SPELL
@@ -97,6 +97,7 @@ SGMLFORMAT_DESC= SGML support
SIDEBAR_PATCH_DESC= Sidebar support
SIGNATURE_MENU_DESC= Signature menu
SLANG_DESC= SLANG support
SMART_DATE_DESC= Dynamic date formatting with "%@"
SMIME_OUTLOOK_COMPAT_DESC= SMIME outlook compatibility
SMTP_DESC= SMTP relay support
TOKYOCABINET_DESC= Use tokyocabinet instead of Berkley DB
@@ -194,6 +195,11 @@ post-patch::
@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-smime-outlook
.endif
.if ${PORT_OPTIONS:MSMART_DATE}
post-patch::
@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-smartdate
.endif
.if ${PORT_OPTIONS:MSIGNATURE_MENU}
IGNORE= the WITH_SIGNATURE_MENU does not work at the moment
XML_NEEDED= yes
@@ -390,7 +396,7 @@ SCRIPTS_ENV+= COMPRESSED_FOLDERS="yes"
SCRIPTS_ENV+= QUOTE_PATCH="yes"
.endif
.if ${PORT_OPTIONS:MIMAP_HEADER_CACHE}
.if ${PORT_OPTIONS:MIMAP_HEADER_CACHE} || ${PORT_OPTIONS:MMAILDIR_HEADER_CACHE}
.if ${PORT_OPTIONS:MTOKYOCABINET}
CONFIGURE_ARGS+= --enable-hcache --without-gdbm --without-bdb --with-tokyocabinet
LIB_DEPENDS+= tokyocabinet.9:${PORTSDIR}/databases/tokyocabinet
+126
View File
@@ -0,0 +1,126 @@
--- mutt.h
+++ mutt.h
@@ -133,6 +133,16 @@
M_FORMAT_NOFILTER = (1<<7) /* do not allow filtering on this pass */
} format_flag;
+/* flags for SmartDate */
+typedef enum {
+ FUTURE = 1,
+ SMARTTIME = 2,
+ YESTERDAY = 3,
+ WEEKDAY = 4,
+ STANDARD = 5,
+ ANCIENT = 6
+} smartdate_type;
+
/* types for mutt_add_hook() */
#define M_FOLDERHOOK 1
#define M_MBOXHOOK (1<<1)
--- hdrline.c
+++ hdrline.c
@@ -231,6 +231,89 @@
* %Y = `x-label:' field (if present, tree unfolded, and != parent's x-label)
* %Z = status flags */
+static void
+format_smartdate( char *buf, size_t max, struct tm *tm, smartdate_type type )
+{
+ char *strftime_fmt = NULL;
+
+ switch( type ) {
+ case FUTURE: /* Date in the future */
+ strftime_fmt = "%d%h%y!";
+ break;
+ case SMARTTIME: /* Today */
+ strftime_fmt = "%I:%M %p";
+ break;
+ case YESTERDAY: /* Yesterday */
+ strncpy( buf, "Yesterday", max );
+ break;
+ case WEEKDAY: /* Within the last 7 days */
+ strftime_fmt = "%A";
+ break;
+ case STANDARD: /* Within the last six months */
+ strftime_fmt = "%h %d";
+ break;
+ case ANCIENT: /* Older than 6 months */
+ strftime_fmt = "%h %Y";
+ break;
+ }
+
+ if( strftime_fmt != NULL ) {
+ strftime( buf, max, strftime_fmt, tm );
+ }
+}
+
+static void
+smartdate( char *buf, size_t max, struct tm *tm )
+{
+ smartdate_type type = 0;
+
+ struct tm now;
+
+ time_t sse = mktime( tm ); /* Seconds since epoch */
+ time_t sse_now = time(NULL); /* Seconds since epoch until now */
+
+ int dse = 0; /* Days since epoch */
+ int dse_now = 0; /* Days since epoch until today */
+
+ /* Calculate the number of days since epoch */
+ dse = sse / (60*60*24);
+ dse_now = sse_now / (60*60*24);
+
+ /* Default display type */
+ type = STANDARD;
+
+ /* Check if the date is in the future */
+ if( dse > dse_now ) {
+ type = FUTURE;
+ }
+ else {
+ int diff = dse_now - dse;
+ if( diff == 0 ) type = SMARTTIME;
+ else if( diff == 1 ) type = YESTERDAY;
+ else if( diff < 7 ) type = WEEKDAY;
+ else if( diff > 215 ) type = ANCIENT; /* Surely older than six
+ months */
+ else if( diff > 180 ) {
+ /*
+ * Slightly heavy calculation to check if the date is more
+ * than six months in the past. This calculation uses
+ * calendar months and not the exact number of days. So,
+ * January 31, 2003 would be considered more than six months
+ * old whether today's date is August 1 or August 31, 2003
+ */
+ int monthdiff;
+ localtime_r( &sse_now, &now );
+ monthdiff = ( now.tm_mon - tm->tm_mon )
+ + ( ( now.tm_year - tm->tm_year ) * 12 );
+ if( monthdiff > 6 ) {
+ type = ANCIENT;
+ }
+ }
+ }
+
+ format_smartdate( buf, max, tm, type );
+}
+
static const char *
hdr_format_str (char *dest,
size_t destlen,
@@ -462,7 +545,13 @@
tm = gmtime (&T);
}
- strftime (buf2, sizeof (buf2), dest, tm);
+ /* Identify the non-strftime smartdate pattern (%@) */
+ if( strncmp( dest, "%@", 2 ) == 0 ) {
+ smartdate( buf2, sizeof( buf2 ), tm );
+ }
+ else {
+ strftime (buf2, sizeof (buf2), dest, tm);
+ }
if (do_locales)
setlocale (LC_TIME, "C");
+112
View File
@@ -0,0 +1,112 @@
--- init.h.orig 2010-09-15 08:39:31.000000000 -0700
+++ init.h 2012-03-28 10:58:42.870572835 -0700
@@ -2972,6 +2972,18 @@ struct option_t MuttVars[] = {
** SSL authentication process.
*/
#ifdef USE_SSL_OPENSSL
+ { "ssl_use_tlsv1_1", DT_BOOL, R_NONE, OPTTLSV1_1, 1 },
+ /*
+ ** .pp
+ ** This variable specifies whether to attempt to use TLSv1.1 in the
+ ** SSL authentication process.
+ */
+ { "ssl_use_tlsv1_2", DT_BOOL, R_NONE, OPTTLSV1_2, 1 },
+ /*
+ ** .pp
+ ** This variable specifies whether to attempt to use TLSv1.2 in the
+ ** SSL authentication process.
+ */
{ "ssl_usesystemcerts", DT_BOOL, R_NONE, OPTSSLSYSTEMCERTS, 1 },
/*
** .pp
--- mutt.h 2010-09-13 10:19:55.000000000 -0700
+++ mutt.h 2012-03-28 10:59:24.437237530 -0700
@@ -376,6 +376,8 @@ enum
# endif /* USE_SSL_GNUTLS */
OPTSSLV3,
OPTTLSV1,
+ OPTTLSV1_1,
+ OPTTLSV1_2,
OPTSSLFORCETLS,
OPTSSLVERIFYDATES,
OPTSSLVERIFYHOST,
--- mutt_ssl.c.orig 2010-08-25 18:31:40.000000000 +0200
+++ mutt_ssl.c 2013-08-20 13:51:14.000000000 +0200
@@ -100,12 +100,33 @@
goto bail;
ssldata = (sslsockdata*) safe_calloc (1, sizeof (sslsockdata));
- /* the ssl_use_xxx protocol options don't apply. We must use TLS in TLS. */
- if (! (ssldata->ctx = SSL_CTX_new (TLSv1_client_method ())))
+ /* the ssl_use_xxx protocol options don't apply. We must use TLS in TLS.
+ * TLSv1.2 support was added in OpenSSL 1.0.1. RHEL6 shipped with 1.0.0 so
+ * our configure script checks for TLSv1.2 availability.
+ */
+ if (! (ssldata->ctx = SSL_CTX_new (
+#ifdef HAVE_TLSV1_2_CLIENT_METHOD
+ TLSv1_2_client_method ()
+#else
+ TLSv1_client_method ()
+#endif
+ )))
{
dprint (1, (debugfile, "mutt_ssl_starttls: Error allocating SSL_CTX\n"));
goto bail_ssldata;
}
+#ifdef SSL_OP_NO_TLSv1_1
+ if (!option(OPTTLSV1_1))
+ {
+ SSL_CTX_set_options(ssldata->ctx, SSL_OP_NO_TLSv1_1);
+ }
+#endif
+#ifdef SSL_OP_NO_TLSv1_2
+ if (!option(OPTTLSV1_2))
+ {
+ SSL_CTX_set_options(ssldata->ctx, SSL_OP_NO_TLSv1_2);
+ }
+#endif
ssl_get_client_cert(ssldata, conn);
@@ -303,6 +324,21 @@
{
SSL_CTX_set_options(data->ctx, SSL_OP_NO_TLSv1);
}
+ /* TLSv1.1/1.2 support was added in OpenSSL 1.0.1, but some OS distros such
+ * as Fedora 17 are on OpenSSL 1.0.0.
+ */
+#ifdef SSL_OP_NO_TLSv1_1
+ if (!option(OPTTLSV1_1))
+ {
+ SSL_CTX_set_options(data->ctx, SSL_OP_NO_TLSv1_1);
+ }
+#endif
+#ifdef SSL_OP_NO_TLSv1_2
+ if (!option(OPTTLSV1_2))
+ {
+ SSL_CTX_set_options(data->ctx, SSL_OP_NO_TLSv1_2);
+ }
+#endif
if (!option(OPTSSLV2))
{
SSL_CTX_set_options(data->ctx, SSL_OP_NO_SSLv2);
@@ -375,8 +411,8 @@
if (!ssl_check_certificate (conn, ssldata))
return -1;
- mutt_message (_("SSL connection using %s (%s)"),
- SSL_get_cipher_version (ssldata->ssl), SSL_get_cipher_name (ssldata->ssl));
+ mutt_message (_("%s connection using %s (%s)"),
+ SSL_get_version(ssldata->ssl), SSL_get_cipher_version (ssldata->ssl), SSL_get_cipher_name (ssldata->ssl));
mutt_sleep (0);
return 0;
@@ -911,7 +947,7 @@
static int interactive_check_cert (X509 *cert, int idx, int len)
{
- char *part[] =
+ static const char * const part[] =
{"/CN=", "/Email=", "/O=", "/OU=", "/L=", "/ST=", "/C="};
char helpstr[LONG_STRING];
char buf[STRING];
+1 -1
View File
@@ -6,6 +6,6 @@ Features include color support, message threading, MIME support (including
RFC1522 support for encoded headers), customizable key bindings, POP3,
Delivery Status Notification (DSN) support, and PGP/MIME.
Mutt User Information: http://www.math.fu-berlin.de/~guckes/mutt/
Mutt FAQ: http://dev.mutt.org/trac/wiki/MuttFaq
WWW: http://www.mutt.org/