changeset: 6827:a8203b4463c1
user:      Kevin McCarthy <ke...@8t8.us>
date:      Sun Oct 23 13:43:56 2016 -0700
link:      http://dev.mutt.org/hg/mutt/rev/a8203b4463c1

Prevent an integer overflow in mutt_mktime() (closes #3880)

Check to make sure the year passed in isn't bigger than can be
represented using time_t on the platform.

Also add a (time_t) cast to an intermediate "years * 365" calculation
to prevent an overflow there.

Thanks to TAKAHASHI Tamotsu for his patch, and to Vincent Lefèvre for
his improvement.  I merely took their code and commited it.

changeset: 6828:40cf141c7383
user:      Kevin McCarthy <ke...@8t8.us>
date:      Sun Oct 23 13:47:14 2016 -0700
link:      http://dev.mutt.org/hg/mutt/rev/40cf141c7383

merge stable

diffs (truncated from 5469 to 950 lines):

diff -r 113b73b0b616 -r 40cf141c7383 OPS
--- a/OPS       Mon Oct 17 11:22:13 2016 -0700
+++ b/OPS       Sun Oct 23 13:47:14 2016 -0700
@@ -124,6 +124,7 @@
 OP_MAIN_PREV_UNREAD "jump to the previous unread message"
 OP_MAIN_READ_THREAD "mark the current thread as read"
 OP_MAIN_READ_SUBTHREAD "mark the current subthread as read"
+OP_MAIN_ROOT_MESSAGE "jump to root message in thread"
 OP_MAIN_SET_FLAG "set a status flag on a message"
 OP_MAIN_SYNC_FOLDER "save changes to mailbox"
 OP_MAIN_TAG_PATTERN "tag messages matching a pattern"
diff -r 113b73b0b616 -r 40cf141c7383 browser.c
--- a/browser.c Mon Oct 17 11:22:13 2016 -0700
+++ b/browser.c Sun Oct 23 13:47:14 2016 -0700
@@ -176,11 +176,12 @@
          tnow = time (NULL);
          t_fmt = tnow - folder->ff->mtime < 31536000 ? "%b %d %H:%M" : "%b %d  
%Y";
        }
-       if (do_locales)
-         setlocale(LC_TIME, NONULL (Locale)); /* use environment if $locale is 
not set */
-       else
-         setlocale(LC_TIME, "C");
-       strftime (date, sizeof (date), t_fmt, localtime (&folder->ff->mtime));
+
+        if (!do_locales)
+          setlocale (LC_TIME, "C");
+        strftime (date, sizeof (date), t_fmt, localtime (&folder->ff->mtime));
+        if (!do_locales)
+          setlocale (LC_TIME, "");
 
        mutt_format_s (dest, destlen, fmt, date);
       }
diff -r 113b73b0b616 -r 40cf141c7383 configure.ac
--- a/configure.ac      Mon Oct 17 11:22:13 2016 -0700
+++ b/configure.ac      Sun Oct 23 13:47:14 2016 -0700
@@ -689,13 +689,16 @@
 
             crypto_libs=""
             AC_CHECK_LIB(z, deflate, [crypto_libs=-lz])
-            AC_CHECK_LIB(crypto, X509_new,
-              [crypto_libs="-lcrypto $crypto_libs"],, [$crypto_libs])
+            AC_CHECK_LIB(crypto, X509_STORE_CTX_new,
+              [crypto_libs="-lcrypto $crypto_libs"],
+              AC_MSG_ERROR([Unable to find SSL library]), [$crypto_libs])
             AC_CHECK_LIB(ssl, SSL_new,,
               AC_MSG_ERROR([Unable to find SSL library]), [$crypto_libs])
 
             LIBS="$LIBS $crypto_libs"
             AC_CHECK_FUNCS(RAND_status RAND_egd)
+            AC_CHECK_DECLS([SSL_set_mode, SSL_MODE_AUTO_RETRY],,
+              AC_MSG_ERROR([Unable to find decent SSL header]), [[#include 
<openssl/ssl.h>]])
 
             AC_DEFINE(USE_SSL,1,[ Define if you want support for SSL. ])
             AC_DEFINE(USE_SSL_OPENSSL,1,[ Define if you want support for SSL 
via OpenSSL. ])
diff -r 113b73b0b616 -r 40cf141c7383 crypt-gpgme.c
--- a/crypt-gpgme.c     Mon Oct 17 11:22:13 2016 -0700
+++ b/crypt-gpgme.c     Sun Oct 23 13:47:14 2016 -0700
@@ -867,14 +867,12 @@
 {
   char p[STRING];
 
-  setlocale (LC_TIME, "");
 #ifdef HAVE_LANGINFO_D_T_FMT
   strftime (p, sizeof (p), nl_langinfo (D_T_FMT), localtime (&t));
 #else
   strftime (p, sizeof (p), "%c", localtime (&t));
 #endif
-  setlocale (LC_TIME, "C");
-  state_attach_puts (p, s);
+  state_puts (p, s);
 }
 
 /* 
@@ -1139,7 +1137,7 @@
 
   if ((sum & GPGME_SIGSUM_KEY_REVOKED))
     {
-      state_attach_puts (_("Warning: One of the keys has been revoked\n"),s);
+      state_puts (_("Warning: One of the keys has been revoked\n"),s);
       severe = 1;
     }
 
@@ -1148,13 +1146,13 @@
       time_t at = key->subkeys->expires ? key->subkeys->expires : 0;
       if (at)
         {
-          state_attach_puts (_("Warning: The key used to create the "
+          state_puts (_("Warning: The key used to create the "
                                "signature expired at: "), s);
           print_time (at , s);
-          state_attach_puts ("\n", s);
+          state_puts ("\n", s);
         }
       else
-        state_attach_puts (_("Warning: At least one certification key "
+        state_puts (_("Warning: At least one certification key "
                              "has expired\n"), s);
     }
 
@@ -1170,29 +1168,29 @@
            sig = sig->next, i++)
         ;
       
-      state_attach_puts (_("Warning: The signature expired at: "), s);
+      state_puts (_("Warning: The signature expired at: "), s);
       print_time (sig ? sig->exp_timestamp : 0, s);
-      state_attach_puts ("\n", s);
+      state_puts ("\n", s);
     }
 
   if ((sum & GPGME_SIGSUM_KEY_MISSING))
-    state_attach_puts (_("Can't verify due to a missing "
+    state_puts (_("Can't verify due to a missing "
                          "key or certificate\n"), s);
 
   if ((sum & GPGME_SIGSUM_CRL_MISSING))
     {
-      state_attach_puts (_("The CRL is not available\n"), s);
+      state_puts (_("The CRL is not available\n"), s);
       severe = 1;
     }
 
   if ((sum & GPGME_SIGSUM_CRL_TOO_OLD))
     {
-      state_attach_puts (_("Available CRL is too old\n"), s);
+      state_puts (_("Available CRL is too old\n"), s);
       severe = 1;
     }
 
   if ((sum & GPGME_SIGSUM_BAD_POLICY))
-    state_attach_puts (_("A policy requirement was not met\n"), s);
+    state_puts (_("A policy requirement was not met\n"), s);
 
   if ((sum & GPGME_SIGSUM_SYS_ERROR))
     {
@@ -1201,7 +1199,7 @@
       gpgme_signature_t sig;
       unsigned int i;
 
-      state_attach_puts (_("A system error occurred"), s );
+      state_puts (_("A system error occurred"), s );
 
       /* Try to figure out some more detailed system error information. */
       result = gpgme_op_verify_result (ctx);
@@ -1216,17 +1214,17 @@
 
       if (t0 || t1)
         {
-          state_attach_puts (": ", s);
+          state_puts (": ", s);
           if (t0)
-              state_attach_puts (t0, s);
+              state_puts (t0, s);
           if (t1 && !(t0 && !strcmp (t0, t1)))
             {
               if (t0)
-                state_attach_puts (",", s);
-              state_attach_puts (t1, s);
+                state_puts (",", s);
+              state_puts (t1, s);
             }
         }
-      state_attach_puts ("\n", s);
+      state_puts ("\n", s);
     }
 
 #ifdef HAVE_GPGME_PKA_TRUST
@@ -1235,16 +1233,16 @@
     {
       if (sig->pka_trust == 1 && sig->pka_address)
        {
-         state_attach_puts (_("WARNING: PKA entry does not match "
+         state_puts (_("WARNING: PKA entry does not match "
                               "signer's address: "), s);
-         state_attach_puts (sig->pka_address, s);
-         state_attach_puts ("\n", s);
+         state_puts (sig->pka_address, s);
+         state_puts ("\n", s);
        }
       else if (sig->pka_trust == 2 && sig->pka_address)
        {
-         state_attach_puts (_("PKA verified signer's address is: "), s);
-         state_attach_puts (sig->pka_address, s);
-         state_attach_puts ("\n", s);
+         state_puts (_("PKA verified signer's address is: "), s);
+         state_puts (sig->pka_address, s);
+         state_puts ("\n", s);
        }
     }
 
@@ -1301,7 +1299,7 @@
     *p++ = *s;
   *p++ = '\n';
   *p = 0;
-  state_attach_puts (buf, state);
+  state_puts (buf, state);
   FREE (&buf);
 }
 
@@ -1339,18 +1337,18 @@
        break;
       }
   if (txt)
-    state_attach_puts (txt, s);
+    state_puts (txt, s);
 }
 
 static void print_smime_keyinfo (const char* msg, gpgme_signature_t sig,
                                  gpgme_key_t key, STATE *s)
 {
-  size_t msglen;
+  int msgwid;
   gpgme_user_id_t uids = NULL;
   int i, aka = 0;
 
-  state_attach_puts (msg, s);
-  state_attach_puts (" ", s);
+  state_puts (msg, s);
+  state_puts (" ", s);
   /* key is NULL when not present in the user's keyring */
   if (key)
   {
@@ -1360,34 +1358,39 @@
        continue;
       if (aka)
       {
-        /* TODO: need to account for msg wide characters
-         * and "aka" translation length */
-       msglen = mutt_strlen (msg) - 4;
-       for (i = 0; i < msglen; i++)
-         state_attach_puts(" ", s);
-       state_attach_puts(_("aka: "), s);
+       msgwid = mutt_strwidth (msg) - mutt_strwidth (_("aka: ")) + 1;
+       if (msgwid < 0)
+         msgwid = 0;
+       for (i = 0; i < msgwid; i++)
+         state_puts(" ", s);
+       state_puts(_("aka: "), s);
       }
-      state_attach_puts (uids->uid, s);
-      state_attach_puts ("\n", s);
+      state_puts (uids->uid, s);
+      state_puts ("\n", s);
 
       aka = 1;
     }
   }
   else
   {
-    state_attach_puts (_("KeyID "), s);
-    state_attach_puts (sig->fpr, s);
-    state_attach_puts ("\n", s);
+    state_puts (_("KeyID "), s);
+    state_puts (sig->fpr, s);
+    state_puts ("\n", s);
   }
 
-  msglen = mutt_strlen (msg) - 8;
-  /* TODO: need to account for msg wide characters
-   * and "created" translation length */
-  for (i = 0; i < msglen; i++)
-    state_attach_puts(" ", s);
-  state_attach_puts (_("created: "), s);
-  print_time (sig->timestamp, s);
-  state_attach_puts ("\n", s);  
+  /* timestamp is 0 when verification failed.
+     "Jan 1 1970" is not the created date. */
+  if (sig->timestamp)
+  {
+    msgwid = mutt_strwidth (msg) - mutt_strwidth (_("created: ")) + 1;
+    if (msgwid < 0)
+      msgwid = 0;
+    for (i = 0; i < msgwid; i++)
+      state_puts(" ", s);
+    state_puts (_("created: "), s);
+    print_time (sig->timestamp, s);
+    state_puts ("\n", s);
+  }
 }
 
 /* Show information about one signature.  This function is called with
@@ -1459,7 +1462,7 @@
           snprintf (buf, sizeof (buf),
               _("Error getting key information for KeyID %s: %s\n"),
               fpr, gpgme_strerror (err));
-          state_attach_puts (buf, s);
+          state_puts (buf, s);
           anybad = 1;
        }
       else if ((sum & GPGME_SIGSUM_GREEN))
@@ -1494,9 +1497,9 @@
           /* L10N:
              This is trying to match the width of the
              "Problem signature from:" translation just above. */
-         state_attach_puts (_("               expires: "), s);
+         state_puts (_("               expires: "), s);
          print_time (sig->exp_timestamp, s);
-         state_attach_puts ("\n", s);
+         state_puts ("\n", s);
        }
        show_sig_summary (sum, ctx, key, idx, s, sig);
         anywarn = 1;
@@ -1555,12 +1558,13 @@
       snprintf (buf, sizeof(buf)-1, 
                 _("Error: verification failed: %s\n"),
                 gpgme_strerror (err));
-      state_attach_puts (buf, s);
+      state_puts (buf, s);
     }
   else
     { /* Verification succeeded, see what the result is. */
       int res, idx;
       int anybad = 0;
+      gpgme_verify_result_t verify_result;
 
       if (signature_key)
        {
@@ -1568,15 +1572,19 @@
          signature_key = NULL;
        }
 
-      for(idx=0; (res = show_one_sig_status (ctx, idx, s)) != -1; idx++)
+      verify_result = gpgme_op_verify_result (ctx);
+      if (verify_result && verify_result->signatures)
+      {
+        for (idx=0; (res = show_one_sig_status (ctx, idx, s)) != -1; idx++)
         {
           if (res == 1)
             anybad = 1;
           else if (res == 2)
             anywarn = 2;
         }
-      if (!anybad)
-        badsig = 0;
+        if (!anybad)
+          badsig = 0;
+      }
     }
 
   if (!badsig)
@@ -1604,7 +1612,7 @@
            snprintf (buf, sizeof (buf),
                      _("*** Begin Notation (signature by: %s) ***\n"),
                      signature->fpr);
-           state_attach_puts (buf, s);
+           state_puts (buf, s);
            for (notation = signature->notations; notation;
                  notation = notation->next)
            {
@@ -1613,18 +1621,18 @@
 
              if (notation->name)
              {
-               state_attach_puts (notation->name, s);
-               state_attach_puts ("=", s);
+               state_puts (notation->name, s);
+               state_puts ("=", s);
              }
              if (notation->value)
              {
-               state_attach_puts (notation->value, s);
+               state_puts (notation->value, s);
                if (!(*notation->value
                       && (notation->value[strlen (notation->value)-1]=='\n')))
-                 state_attach_puts ("\n", s);
+                 state_puts ("\n", s);
              }
            }
-           state_attach_puts (_("*** End Notation ***\n"), s);
+           state_puts (_("*** End Notation ***\n"), s);
          }
        }
       }
@@ -2438,7 +2446,7 @@
                   snprintf (errbuf, sizeof(errbuf)-1, 
                             _("Error: decryption/verification failed: %s\n"),
                             gpgme_strerror (err));
-                  state_attach_puts (errbuf, s);
+                  state_puts (errbuf, s);
                 }
               else
                 { /* Decryption/Verification succeeded */
@@ -2481,7 +2489,7 @@
                   if (!tmpfname)
                     {
                       pgpout = NULL;
-                      state_attach_puts (_("Error: copy data failed\n"), s);
+                      state_puts (_("Error: copy data failed\n"), s);
                     }
                   else
                     {
@@ -2813,9 +2821,6 @@
        }
        *p = 0;
 
-       if (do_locales && Locale)
-         setlocale (LC_TIME, Locale);
-        
         {
          time_t tt = 0;
 
@@ -2824,11 +2829,13 @@
 
           tm = localtime (&tt);
         }
-       strftime (buf2, sizeof (buf2), dest, tm);
-
-       if (do_locales)
-         setlocale (LC_TIME, "C");
-        
+
+        if (!do_locales)
+          setlocale (LC_TIME, "C");
+        strftime (buf2, sizeof (buf2), dest, tm);
+        if (!do_locales)
+          setlocale (LC_TIME, "");
+
        snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
        snprintf (dest, destlen, fmt, buf2);
        if (len > 0)
@@ -3369,9 +3376,6 @@
   int i;
   gpgme_user_id_t uid = NULL;
 
-  if (Locale)
-    setlocale (LC_TIME, Locale);
-
   is_pgp = key->protocol == GPGME_PROTOCOL_OpenPGP;
 
   for (idx = 0, uid = key->uids; uid; idx++, uid = uid->next)
@@ -3611,9 +3615,6 @@
           putc ('\n', fp);
         }
     }
-
-  if (Locale)
-    setlocale (LC_TIME, "C");
 }
 
 
diff -r 113b73b0b616 -r 40cf141c7383 crypt.c
--- a/crypt.c   Mon Oct 17 11:22:13 2016 -0700
+++ b/crypt.c   Sun Oct 23 13:47:14 2016 -0700
@@ -64,9 +64,7 @@
   if (option (OPTCRYPTTIMESTAMP))
   {
     t = time(NULL);
-    setlocale (LC_TIME, "");
     strftime (p, sizeof (p), _(" (current time: %c)"), localtime (&t));
-    setlocale (LC_TIME, "C");
   }
   else
     *p = '\0';
diff -r 113b73b0b616 -r 40cf141c7383 curs_lib.c
--- a/curs_lib.c        Mon Oct 17 11:22:13 2016 -0700
+++ b/curs_lib.c        Sun Oct 23 13:47:14 2016 -0700
@@ -125,9 +125,10 @@
     return err;
   }
 
-  if(ch == ERR)
+  /* either timeout, a sigwinch (if timeout is set), or the terminal
+   * has been lost */
+  if (ch == ERR)
   {
-    /* either timeout or the terminal has been lost */
     if (!isatty (0))
     {
       endwin ();
diff -r 113b73b0b616 -r 40cf141c7383 curs_main.c
--- a/curs_main.c       Mon Oct 17 11:22:13 2016 -0700
+++ b/curs_main.c       Sun Oct 23 13:47:14 2016 -0700
@@ -474,7 +474,7 @@
   }
 
   if ((Sort & SORT_MASK) == SORT_THREADS && menu->current < 0)
-    menu->current = mutt_parent_message (Context, current);
+    menu->current = mutt_parent_message (Context, current, 0);
 
   if (menu->current < 0)
     menu->current = ci_first_message ();
@@ -1791,12 +1791,14 @@
          menu->redraw = REDRAW_MOTION;
        break;
 
+      case OP_MAIN_ROOT_MESSAGE:
       case OP_MAIN_PARENT_MESSAGE:
 
        CHECK_MSGCOUNT;
         CHECK_VISIBLE;
 
-       if ((menu->current = mutt_parent_message (Context, CURHDR)) < 0)
+       if ((menu->current = mutt_parent_message (Context, CURHDR,
+                                                  op == OP_MAIN_ROOT_MESSAGE)) 
< 0)
        {
          menu->current = menu->oldcurrent;
        }
diff -r 113b73b0b616 -r 40cf141c7383 date.c
--- a/date.c    Mon Oct 17 11:22:13 2016 -0700
+++ b/date.c    Sun Oct 23 13:47:14 2016 -0700
@@ -63,6 +63,10 @@
   return (compute_tz (t, &utc));
 }
 
+/* theoretically time_t can be float but it is integer on most (if not all) 
systems */
+#define TIME_T_MAX ((((time_t) 1 << (sizeof(time_t) * 8 - 2)) - 1) * 2 + 1)
+#define TM_YEAR_MAX (1970 + (((((TIME_T_MAX - 59) / 60) - 59) / 60) - 23) / 24 
/ 366)
+
 /* converts struct tm to time_t, but does not take the local timezone into
    account unless ``local'' is nonzero */
 time_t mutt_mktime (struct tm *t, int local)
@@ -73,6 +77,10 @@
     0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
   };
 
+  /* Prevent an integer overflow */
+  if (t->tm_year > TM_YEAR_MAX)
+    return TIME_T_MAX;
+
   /* Compute the number of days since January 1 in the same year */
   g = AccumDaysPerMonth [t->tm_mon % 12];
 
@@ -84,7 +92,7 @@
   t->tm_yday = g;
 
   /* Compute the number of days since January 1, 1970 */
-  g += (t->tm_year - 70) * 365;
+  g += (t->tm_year - 70) * (time_t)365;
   g += (t->tm_year - 69) / 4;
 
   /* Compute the number of hours */
diff -r 113b73b0b616 -r 40cf141c7383 doc/manual.xml.head
--- a/doc/manual.xml.head       Mon Oct 17 11:22:13 2016 -0700
+++ b/doc/manual.xml.head       Sun Oct 23 13:47:14 2016 -0700
@@ -3624,8 +3624,8 @@
 <para>
 Another typical use for this command is to change the values of the
 <link linkend="attribution">$attribution</link>, <link
-linkend="signature">$signature</link> and <link
-linkend="locale">$locale</link> variables in order to change the
+linkend="attribution-locale">$attribution_locale</link>, and <link
+linkend="signature">$signature</link> variables in order to change the
 language of the attributions and signatures based upon the recipients.
 </para>
 
@@ -8291,6 +8291,14 @@
       <arg choice="opt" rep="repeat">
        <replaceable class="parameter">mailbox</replaceable>
       </arg>
+
+      <command>unsidebar_whitelist<anchor id="unsidebar-whitelist"/></command>
+      <arg choice="plain">
+       <replaceable class="parameter">*</replaceable>
+      </arg>
+      <arg choice="plain" rep="repeat">
+       <replaceable class="parameter">mailbox</replaceable>
+      </arg>
     </cmdsynopsis>
 
     <para>
@@ -8299,6 +8307,12 @@
       linkend="sidebar-new-mail-only">$sidebar_new_mail_only</link>
       is set and the mailbox does not contain new mail.
     </para>
+
+    <para>
+      The <quote>unsidebar_whitelist</quote> command is used to remove a 
mailbox from
+      the list of whitelisted mailboxes. Use <quote>unsidebar_whitelist 
*</quote>
+      to remove all mailboxes.
+    </para>
   </sect2>
 
   <sect2 id="sidebar-colors">
@@ -9571,13 +9585,24 @@
 <cmdsynopsis>
 <command><link linkend="sidebar-whitelist">sidebar_whitelist</link></command>
 <arg choice="plain">
-<replaceable class="parameter">item</replaceable>
-</arg>
-<arg choice="plain">
-<replaceable class="parameter">command</replaceable>
-</arg>
+<replaceable class="parameter">mailbox</replaceable>
+</arg>
+<arg choice="opt" rep="repeat">
+<replaceable class="parameter">mailbox</replaceable>
+</arg>
+
+<command><link 
linkend="unsidebar-whitelist">unsidebar_whitelist</link></command>
+<group choice="req">
+<arg choice="plain">
+<replaceable class="parameter">*</replaceable>
+</arg>
+<arg choice="plain" rep="repeat">
+<replaceable class="parameter">mailbox</replaceable>
+</arg>
+</group>
 </cmdsynopsis>
 </listitem>
+
 <listitem>
 <cmdsynopsis>
 <command><link linkend="source">source</link></command>
diff -r 113b73b0b616 -r 40cf141c7383 edit.c
--- a/edit.c    Mon Oct 17 11:22:13 2016 -0700
+++ b/edit.c    Sun Oct 23 13:47:14 2016 -0700
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <locale.h>
 #include <ctype.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -160,7 +161,9 @@
       /* add the attribution */
       if (Attribution)
       {
+        setlocale (LC_TIME, NONULL (AttributionLocale));
        mutt_make_string (tmp, sizeof (tmp) - 1, Attribution, Context, 
Context->hdrs[n]);
+        setlocale (LC_TIME, "");
        strcat (tmp, "\n");     /* __STRCAT_CHECKED__ */
       }
 
diff -r 113b73b0b616 -r 40cf141c7383 functions.h
--- a/functions.h       Mon Oct 17 11:22:13 2016 -0700
+++ b/functions.h       Sun Oct 23 13:47:14 2016 -0700
@@ -160,6 +160,7 @@
   { "next-unread",             OP_MAIN_NEXT_UNREAD,            NULL },
   { "previous-unread",         OP_MAIN_PREV_UNREAD,            NULL },
   { "parent-message",          OP_MAIN_PARENT_MESSAGE,         "P" },
+  { "root-message",            OP_MAIN_ROOT_MESSAGE,           NULL },
 
 
   { "extract-keys",            OP_EXTRACT_KEYS,                "\013" },
@@ -271,6 +272,7 @@
   { "previous-line",   OP_PREV_LINE,                   NULL },
   { "bottom",          OP_PAGER_BOTTOM,                NULL },
   { "parent-message",  OP_MAIN_PARENT_MESSAGE,         "P" },
+  { "root-message",    OP_MAIN_ROOT_MESSAGE,           NULL },
 
 
 
diff -r 113b73b0b616 -r 40cf141c7383 globals.h
--- a/globals.h Mon Oct 17 11:22:13 2016 -0700
+++ b/globals.h Sun Oct 23 13:47:14 2016 -0700
@@ -36,6 +36,7 @@
 WHERE char *AssumedCharset;
 WHERE char *AttachSep;
 WHERE char *Attribution;
+WHERE char *AttributionLocale;
 WHERE char *AttachCharset;
 WHERE char *AttachFormat;
 WHERE char *Charset;
@@ -66,7 +67,6 @@
 #endif
 WHERE char *Inbox;
 WHERE char *Ispell;
-WHERE char *Locale;
 WHERE char *MailcapPath;
 WHERE char *Maildir;
 #if defined(USE_IMAP) || defined(USE_POP)
diff -r 113b73b0b616 -r 40cf141c7383 hdrline.c
--- a/hdrline.c Mon Oct 17 11:22:13 2016 -0700
+++ b/hdrline.c Sun Oct 23 13:47:14 2016 -0700
@@ -383,9 +383,6 @@
        }
        *p = 0;
 
-       if (do_locales && Locale)
-         setlocale (LC_TIME, Locale);
-
        if (op == '[' || op == 'D')
          tm = localtime (&hdr->date_sent);
        else if (op == '(')
@@ -406,10 +403,11 @@
          tm = gmtime (&T);
        }
 
-       strftime (buf2, sizeof (buf2), dest, tm);
-
-       if (do_locales)
-         setlocale (LC_TIME, "C");
+        if (!do_locales)
+          setlocale (LC_TIME, "C");
+        strftime (buf2, sizeof (buf2), dest, tm);
+        if (!do_locales)
+          setlocale (LC_TIME, "");
 
        mutt_format_s (dest, destlen, prefix, buf2);
        if (len > 0 && op != 'd' && op != 'D') /* Skip ending op */
diff -r 113b73b0b616 -r 40cf141c7383 imap/imap.c
--- a/imap/imap.c       Mon Oct 17 11:22:13 2016 -0700
+++ b/imap/imap.c       Sun Oct 23 13:47:14 2016 -0700
@@ -2116,6 +2116,14 @@
   /* loop in case of TRYCREATE */
   do
   {
+    rc = imap_exec_msgset (idata, "UID STORE", "+FLAGS.SILENT (\\Seen)",
+                           MUTT_TRASH, 0, 0);
+    if (rc < 0)
+    {
+      dprint (1, (debugfile, "imap_fast_trash: Unable to mark messages as 
seen\n"));
+      goto out;
+    }
+
     rc = imap_exec_msgset (idata, "UID COPY", mmbox, MUTT_TRASH, 0, 0);
     if (!rc)
     {
diff -r 113b73b0b616 -r 40cf141c7383 init.h
--- a/init.h    Mon Oct 17 11:22:13 2016 -0700
+++ b/init.h    Sun Oct 23 13:47:14 2016 -0700
@@ -266,6 +266,18 @@
   ** in a reply.  For a full listing of defined \fCprintf(3)\fP-like sequences 
see
   ** the section on $$index_format.
   */
+  { "attribution_locale", DT_STR, R_NONE, UL &AttributionLocale, UL "" },
+  /*
+  ** .pp
+  ** The locale used by \fCstrftime(3)\fP to format dates in the
+  ** $attribution string.  Legal values are the strings your system
+  ** accepts for the locale environment variable \fC$$$LC_TIME\fP.
+  ** .pp
+  ** This variable is to allow the attribution date format to be
+  ** customized by recipient or folder using hooks.  By default, Mutt
+  ** will use your locale environment, so there is no need to set
+  ** this except to override that default.
+  */
   { "auto_tag",                DT_BOOL, R_NONE, OPTAUTOTAG, 0 },
   /*
   ** .pp
@@ -599,8 +611,8 @@
   ** function to process the date, see the man page for the proper syntax.
   ** .pp
   ** Unless the first character in the string is a bang (``!''), the month
-  ** and week day names are expanded according to the locale specified in
-  ** the variable $$locale. If the first character in the string is a
+  ** and week day names are expanded according to the locale.
+  ** If the first character in the string is a
   ** bang, the bang is discarded, and the month and week day names in the
   ** rest of the string are expanded in the \fIC\fP locale (that is in US
   ** English).
@@ -1395,12 +1407,6 @@
   ** from your spool mailbox to your $$mbox mailbox, or as a result of
   ** a ``$mbox-hook'' command.
   */
-  { "locale",          DT_STR,  R_BOTH, UL &Locale, UL "C" },
-  /*
-  ** .pp
-  ** The locale used by \fCstrftime(3)\fP to format dates. Legal values are
-  ** the strings your system accepts for the locale environment variable 
\fC$$$LC_TIME\fP.
-  */
   { "mail_check",      DT_NUM,  R_NONE, UL &BuffyTimeout, 5 },
   /*
   ** .pp
@@ -2667,7 +2673,10 @@
   ** .pp
   ** Specifies the program and arguments used to deliver mail sent by Mutt.
   ** Mutt expects that the specified program interprets additional
-  ** arguments as recipient addresses.
+  ** arguments as recipient addresses.  Mutt appends all recipients after
+  ** adding a \fC--\fP delimiter (if not already present).  Additional
+  ** flags, such as for $$use_8bitmime, $$use_envelope_from,
+  ** $$dsn_notify, or $$dsn_return will be added before the delimiter.
   */
   { "sendmail_wait",   DT_NUM,  R_NONE, UL &SendmailWait, 0 },
   /*
@@ -3928,6 +3937,7 @@
   { "set",             parse_set,              0 },
 #ifdef USE_SIDEBAR
   { "sidebar_whitelist",parse_list,            UL &SidebarWhitelist },
+  { "unsidebar_whitelist",parse_unlist,                UL &SidebarWhitelist },
 #endif
   { "source",          parse_source,           0 },
   { "spam",            parse_spam_list,        MUTT_SPAM },
diff -r 113b73b0b616 -r 40cf141c7383 keymap.c
--- a/keymap.c  Mon Oct 17 11:22:13 2016 -0700
+++ b/keymap.c  Sun Oct 23 13:47:14 2016 -0700
@@ -461,13 +461,13 @@
     tmp = mutt_getch();
     timeout (-1);
 
-    /* hide timeouts from line editor */
+#ifdef USE_IMAP
+  gotkey:
+#endif
+    /* hide timeouts and window resizes from line editor. */
     if (menu == MENU_EDITOR && tmp.ch == -2)
       continue;
 
-#ifdef USE_IMAP
-  gotkey:
-#endif
     LastKey = tmp.ch;
     if (LastKey < 0)
       return -1;
diff -r 113b73b0b616 -r 40cf141c7383 main.c
--- a/main.c    Mon Oct 17 11:22:13 2016 -0700
+++ b/main.c    Sun Oct 23 13:47:14 2016 -0700
@@ -597,15 +597,14 @@
     exit(1);
   }
 
+  setlocale (LC_ALL, "");
+
 #ifdef ENABLE_NLS
   /* FIXME what about init.c:1439 ? */
-  setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, MUTTLOCALEDIR);
   textdomain (PACKAGE);
 #endif
 
-  setlocale (LC_CTYPE, "");
-
   mutt_error = mutt_nocurses_error;
   mutt_message = mutt_nocurses_error;
   SRAND (time (NULL));
diff -r 113b73b0b616 -r 40cf141c7383 mbyte.c
--- a/mbyte.c   Mon Oct 17 11:22:13 2016 -0700
+++ b/mbyte.c   Sun Oct 23 13:47:14 2016 -0700
@@ -530,6 +530,7 @@
   if (wc == (wchar_t)0x200f ||   /* bidi markers: #3827 */
       wc == (wchar_t)0x200e ||
       wc == (wchar_t)0x00ad ||   /* soft hyphen: #3848 */
+      wc == (wchar_t)0xfeff ||   /* zero width no-break space */
       (wc >= (wchar_t)0x202a &&  /* misc directional markers: #3854 */
        wc <= (wchar_t)0x202e))
     return 1;
diff -r 113b73b0b616 -r 40cf141c7383 mutt_ssl.c
--- a/mutt_ssl.c        Mon Oct 17 11:22:13 2016 -0700
+++ b/mutt_ssl.c        Sun Oct 23 13:47:14 2016 -0700
@@ -37,12 +37,6 @@
 #include "mutt_ssl.h"
 #include "mutt_idna.h"
 
-#if OPENSSL_VERSION_NUMBER >= 0x00904000L
-#define READ_X509_KEY(fp, key) PEM_read_X509(fp, key, NULL, NULL)
-#else
-#define READ_X509_KEY(fp, key) PEM_read_X509(fp, key, NULL)
-#endif
-
 /* Just in case OpenSSL doesn't define DEVRANDOM */
 #ifndef DEVRANDOM
 #define DEVRANDOM "/dev/urandom"
@@ -406,11 +400,7 @@
   int err;
   const char* errmsg;
 
-#if OPENSSL_VERSION_NUMBER >= 0x00906000L
-  /* This only exists in 0.9.6 and above. Without it we may get interrupted
-   *   reads or writes. Bummer. */
   SSL_set_mode (ssldata->ssl, SSL_MODE_AUTO_RETRY);
-#endif
 
   if ((err = SSL_connect (ssldata->ssl)) != 1)
   {
@@ -631,7 +621,7 @@
 
 static int check_certificate_by_signer (X509 *peercert)
 {
-  X509_STORE_CTX xsc;
+  X509_STORE_CTX *xsc;
   X509_STORE *ctx;
   int pass = 0, i;
 
@@ -661,23 +651,25 @@
     return 0;
   }
 
-  X509_STORE_CTX_init (&xsc, ctx, peercert, SslSessionCerts);
+  xsc = X509_STORE_CTX_new();
+  if (xsc == NULL) return 0;
+  X509_STORE_CTX_init (xsc, ctx, peercert, SslSessionCerts);
 
-  pass = (X509_verify_cert (&xsc) > 0);
+  pass = (X509_verify_cert (xsc) > 0);
 #ifdef DEBUG
   if (! pass)
   {
     char buf[SHORT_STRING];
     int err;
 
-    err = X509_STORE_CTX_get_error (&xsc);
+    err = X509_STORE_CTX_get_error (xsc);
     snprintf (buf, sizeof (buf), "%s (%d)",
        X509_verify_cert_error_string(err), err);
     dprint (2, (debugfile, "X509_verify_cert: %s\n", buf));
     dprint (2, (debugfile, " [%s]\n", peercert->name));
   }
 #endif
-  X509_STORE_CTX_cleanup (&xsc);
+  X509_STORE_CTX_free (xsc);
   X509_STORE_free (ctx);
 
   return pass;
@@ -766,7 +758,7 @@
     return 0;
   }
 
-  while ((cert = READ_X509_KEY (fp, &cert)) != NULL)
+  while ((cert = PEM_read_X509 (fp, &cert, NULL, NULL)) != NULL)
   {
     pass = compare_certificates (cert, peercert, peermd, peermdlen) ? 0 : 1;
 
@@ -1123,6 +1115,7 @@
   }
   unset_option(OPTIGNOREMACROEVENTS);
   mutt_menuDestroy (&menu);
+  set_option (OPTNEEDREDRAW);
   dprint (2, (debugfile, "ssl interactive_check_cert: done=%d\n", done));
   return (done == 2);
 }
diff -r 113b73b0b616 -r 40cf141c7383 muttlib.c
--- a/muttlib.c Mon Oct 17 11:22:13 2016 -0700
+++ b/muttlib.c Sun Oct 23 13:47:14 2016 -0700
@@ -314,6 +314,26 @@
   }
 }
 
+LIST *mutt_copy_list (LIST *p)
+{
+  LIST *t, *r=NULL, *l=NULL;
+
+  for (; p; p = p->next)
+  {
+    t = (LIST *) safe_malloc (sizeof (LIST));
+    t->data = safe_strdup (p->data);
+    t->next = NULL;
+    if (l)
+    { 
+      r->next = t;
+      r = r->next;
+    }
+    else
+      l = r = t;
+  }
+  return (l);
+}
+
 HEADER *mutt_dup_header(HEADER *h)
 {
   HEADER *hnew;
diff -r 113b73b0b616 -r 40cf141c7383 pager.c
--- a/pager.c   Mon Oct 17 11:22:13 2016 -0700
+++ b/pager.c   Sun Oct 23 13:47:14 2016 -0700
@@ -2867,12 +2867,16 @@
   if (IsHeader (extra))
   {
     Context->msgnotreadyet = -1;
-    if (rc == -1)

Reply via email to