changeset: 6334:4dde4bcda519 user: Michael Elkins <[email protected]> date: Wed Oct 23 11:11:23 2013 -0700 link: http://dev.mutt.org/hg/mutt/rev/4dde4bcda519
only terminate the write-half of the TLS connection to avoid hanging if the remote doesn't respond. RFC5246 section 7.2.4 states that the initiator of the closure need not wait for the remote to response before closing the read-half. closes #3633 changeset: 6335:db3028e34ce0 user: Michael Elkins <[email protected]> date: Wed Oct 23 11:11:23 2013 -0700 link: http://dev.mutt.org/hg/mutt/rev/db3028e34ce0 return 0 if import of cert failed to match other error conditions. changeset: 6336:dd67e8649ea4 user: Michael Elkins <[email protected]> date: Fri Oct 04 18:04:02 2013 +0000 link: http://dev.mutt.org/hg/mutt/rev/dd67e8649ea4 Display the KeyID when the pubkey is not found in the user's keyring during signature verification. closes #3654 changeset: 6337:99d913f46eb9 user: Michael Elkins <[email protected]> date: Sun Oct 06 09:15:57 2013 -0700 link: http://dev.mutt.org/hg/mutt/rev/99d913f46eb9 use LOFF_T as the type for variables used in fseeko() closes #3487 changeset: 6338:331d48da153b user: Michael Elkins <[email protected]> date: Wed Oct 23 11:11:25 2013 -0700 link: http://dev.mutt.org/hg/mutt/rev/331d48da153b Ensure that at least one signature was generated to catch the case where $pgp_sign_as is unset and no default key is specified in ~/.gnupg/gpg.conf closes #3658 changeset: 6339:95a2230ef889 user: Michael Elkins <[email protected]> date: Fri Oct 04 18:22:15 2013 +0000 link: http://dev.mutt.org/hg/mutt/rev/95a2230ef889 When recalling a postponed message that does not have a x-mutt-fcc header field, generate a default FCC just as we do for new messages. If x-mutt-fcc is present but empty, we assume that means the user does not want a copy. closes #3653 changeset: 6340:1e935cab6f17 user: Michael Elkins <[email protected]> date: Wed Oct 23 11:20:24 2013 -0700 link: http://dev.mutt.org/hg/mutt/rev/1e935cab6f17 merge changesets from stable branch diffs (531 lines): diff -r 2ab618f4f6b0 -r 1e935cab6f17 UPDATING --- a/UPDATING Tue Oct 22 21:11:55 2013 -0700 +++ b/UPDATING Wed Oct 23 11:20:24 2013 -0700 @@ -4,6 +4,11 @@ The keys used are: !: modified feature, -: deleted feature, +: new feature +1.5.23 (unreleased): + + + terminal status-line (TS) support, a.k.a. xterm title. see the + following variables: $ts_enabled, $ts_icon_format, $ts_status_format + 1.5.22 (2013-10-18): ! $imap_keepalive default lowered to 300 diff -r 2ab618f4f6b0 -r 1e935cab6f17 configure.ac --- a/configure.ac Tue Oct 22 21:11:55 2013 -0700 +++ b/configure.ac Wed Oct 23 11:20:24 2013 -0700 @@ -295,6 +295,7 @@ if test "$ac_cv_func_decl_resizeterm" = yes; then MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS resize.o" fi + AC_CHECK_FUNCS([use_extended_names]) LIBS="$old_LIBS" ]) diff -r 2ab618f4f6b0 -r 1e935cab6f17 crypt-gpgme.c --- a/crypt-gpgme.c Tue Oct 22 21:11:55 2013 -0700 +++ b/crypt-gpgme.c Wed Oct 23 11:20:24 2013 -0700 @@ -818,6 +818,7 @@ char buf[100]; gpgme_ctx_t ctx; gpgme_data_t message, signature; + gpgme_sign_result_t sigres; convert_to_7bit (a); /* Signed data _must_ be in 7-bit format. */ @@ -859,6 +860,17 @@ mutt_error (_("error signing data: %s\n"), gpgme_strerror (err)); return NULL; } + /* Check for zero signatures generated. This can occur when $pgp_sign_as is + * unset and there is no default key specified in ~/.gnupg/gpg.conf + */ + sigres = gpgme_op_sign_result (ctx); + if (!sigres->signatures) + { + gpgme_data_release (signature); + gpgme_release (ctx); + mutt_error (_("$pgp_sign_as unset and no default key specified in ~/.gnupg/gpg.conf")); + return NULL; + } sigfile = data_object_to_tempfile (signature, NULL); gpgme_data_release (signature); @@ -1263,21 +1275,31 @@ state_attach_puts (msg, s); state_attach_puts (" ", s); - for (uids = key->uids; uids; uids = uids->next) + /* key is NULL when not present in the user's keyring */ + if (key) { - if (uids->revoked) - continue; - if (aka) + for (uids = key->uids; uids; uids = uids->next) { - msglen = mutt_strlen (msg) - 4; - for (i = 0; i < msglen; i++) - state_attach_puts(" ", s); - state_attach_puts(_("aka: "), s); + if (uids->revoked) + continue; + if (aka) + { + msglen = mutt_strlen (msg) - 4; + for (i = 0; i < msglen; i++) + state_attach_puts(" ", s); + state_attach_puts(_("aka: "), s); + } + state_attach_puts (uids->uid, s); + state_attach_puts ("\n", s); + + aka = 1; } - state_attach_puts (uids->uid, s); + } + else + { + state_attach_puts (_("KeyID "), s); + state_attach_puts (sig->fpr, s); state_attach_puts ("\n", s); - - aka = 1; } msglen = mutt_strlen (msg) - 8; @@ -1330,23 +1352,32 @@ if (gpg_err_code (sig->status) != GPG_ERR_NO_ERROR) anybad = 1; - err = gpgme_get_key (ctx, fpr, &key, 0); /* secret key? */ - if (! err) + if (gpg_err_code (sig->status) != GPG_ERR_NO_PUBKEY) + { + err = gpgme_get_key (ctx, fpr, &key, 0); /* secret key? */ + if (! err) { if (! signature_key) signature_key = key; } + else + { + key = NULL; /* Old gpgme versions did not set KEY to NULL on + error. Do it here to avoid a double free. */ + } + } else - { - key = NULL; /* Old gpgme versions did not set KEY to NULL on - error. Do it here to avoid a double free. */ - } + { + /* pubkey not present */ + } if (!s || !s->fpout || !(s->flags & M_DISPLAY)) ; /* No state information so no way to print anything. */ else if (err) { - state_attach_puts (_("Error getting key information: "), s); + state_attach_puts (_("Error getting key information for KeyID "), s); + state_attach_puts ( fpr, s ); + state_attach_puts (_(": "), s); state_attach_puts ( gpgme_strerror (err), s ); state_attach_puts ("\n", s); anybad = 1; @@ -1377,9 +1408,13 @@ else /* can't decide (yellow) */ { print_smime_keyinfo (_("Problem signature from:"), sig, key, s); - state_attach_puts (_(" expires: "), s); - print_time (sig->exp_timestamp, s); - state_attach_puts ("\n", s); + /* 0 indicates no expiration */ + if (sig->exp_timestamp) + { + state_attach_puts (_(" expires: "), s); + print_time (sig->exp_timestamp, s); + state_attach_puts ("\n", s); + } show_sig_summary (sum, ctx, key, idx, s, sig); anywarn = 1; } diff -r 2ab618f4f6b0 -r 1e935cab6f17 curs_main.c --- a/curs_main.c Tue Oct 22 21:11:55 2013 -0700 +++ b/curs_main.c Wed Oct 23 11:20:24 2013 -0700 @@ -110,6 +110,83 @@ extern size_t UngetCount; +/* de facto standard escapes for tsl/fsl */ +static char *tsl = "\033]0;"; +static char *fsl = "\007"; + +/* terminal status capability check. terminfo must have been initialized. */ +short mutt_ts_capability(void) +{ + char *term = getenv("TERM"); + char *tcaps; + int tcapi; + char **termp; + char *known[] = { + "color-xterm", + "cygwin", + "eterm", + "kterm", + "nxterm", + "putty", + "rxvt", + "screen", + "xterm", + NULL + }; + + /* If tsl is set, then terminfo says that status lines work. */ + tcaps = tigetstr("tsl"); + if (tcaps && tcaps != (char *)-1 && *tcaps) + { + /* update the static defns of tsl/fsl from terminfo */ + tsl = safe_strdup(tcaps); + + tcaps = tigetstr("fsl"); + if (tcaps && tcaps != (char *)-1 && *tcaps) + fsl = safe_strdup(tcaps); + + return 1; + } + + /* If XT (boolean) is set, then this terminal supports the standard escape. */ + /* Beware: tigetflag returns -1 if XT is invalid or not a boolean. */ +#ifdef HAVE_USE_EXTENDED_NAMES + use_extended_names (TRUE); + tcapi = tigetflag("XT"); + if (tcapi == 1) + return 1; +#endif /* HAVE_USE_EXTENDED_NAMES */ + + /* Check term types that are known to support the standard escape without + * necessarily asserting it in terminfo. */ + for (termp = known; termp; termp++) + { + if (term && *termp && mutt_strncasecmp (term, *termp, strlen(*termp))) + return 1; + } + + /* not supported */ + return 0; +} + +void mutt_ts_status(char *str) +{ + /* If empty, do not set. To clear, use a single space. */ + if (str == NULL || *str == '\0') + return; + fprintf(stderr, "%s%s%s", tsl, str, fsl); +} + +void mutt_ts_icon(char *str) +{ + /* If empty, do not set. To clear, use a single space. */ + if (str == NULL || *str == '\0') + return; + + /* icon setting is not supported in terminfo, so hardcode the escape - yuck */ + fprintf(stderr, "\033]1;%s\007", str); +} + void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num) { format_flag flag = M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR | M_FORMAT_INDEX; @@ -560,6 +637,13 @@ mutt_paddstr (COLS, buf); NORMAL_COLOR; menu->redraw &= ~REDRAW_STATUS; + if (option(OPTTSENABLED) && TSSupported) + { + menu_status_line (buf, sizeof (buf), menu, NONULL (TSStatusFormat)); + mutt_ts_status(buf); + menu_status_line (buf, sizeof (buf), menu, NONULL (TSIconFormat)); + mutt_ts_icon(buf); + } } menu->redraw = 0; diff -r 2ab618f4f6b0 -r 1e935cab6f17 globals.h --- a/globals.h Tue Oct 22 21:11:55 2013 -0700 +++ b/globals.h Wed Oct 23 11:20:24 2013 -0700 @@ -139,6 +139,9 @@ WHERE char *Status; WHERE char *Tempdir; WHERE char *Tochars; +WHERE char *TSStatusFormat; +WHERE char *TSIconFormat; +WHERE short TSSupported; WHERE char *Username; WHERE char *Visual; diff -r 2ab618f4f6b0 -r 1e935cab6f17 handler.c --- a/handler.c Tue Oct 22 21:11:55 2013 -0700 +++ b/handler.c Wed Oct 23 11:20:24 2013 -0700 @@ -1595,7 +1595,7 @@ FILE *fp = NULL; char tempfile[_POSIX_PATH_MAX]; handler_t handler = NULL; - long tmpoffset = 0; + LOFF_T tmpoffset = 0; size_t tmplength = 0; int rc = 0; diff -r 2ab618f4f6b0 -r 1e935cab6f17 init.h --- a/init.h Tue Oct 22 21:11:55 2013 -0700 +++ b/init.h Wed Oct 23 11:20:24 2013 -0700 @@ -3241,6 +3241,27 @@ ** by \fIyou\fP. The sixth character is used to indicate when a mail ** was sent to a mailing-list you subscribe to. */ + {"ts_icon_format", DT_STR, R_BOTH, UL &TSIconFormat, UL "M%?n?AIL&ail?"}, + /* + ** .pp + ** Controls the format of the icon title, as long as ``$$ts_enabled'' is set. + ** This string is identical in formatting to the one used by + ** ``$$status_format''. + */ + {"ts_enabled", DT_BOOL, R_BOTH, OPTTSENABLED, 0}, + /* The default must be off to force in the validity checking. */ + /* + ** .pp + ** Controls whether mutt tries to set the terminal status line and icon name. + ** Most terminal emulators emulate the status line in the window title. + */ + {"ts_status_format", DT_STR, R_BOTH, UL &TSStatusFormat, UL "Mutt with %?m?%m messages&no messages?%?n? [%n NEW]?"}, + /* + ** .pp + ** Controls the format of the terminal status line (or window title), + ** provided that ``$$ts_enabled'' has been set. This string is identical in + ** formatting to the one used by ``$$status_format''. + */ #ifdef USE_SOCKET { "tunnel", DT_STR, R_NONE, UL &Tunnel, UL 0 }, /* @@ -3412,6 +3433,15 @@ ** Also see the $$read_inc, $$net_inc and $$time_inc variables and the ** ``$tuning'' section of the manual for performance considerations. */ + {"xterm_icon", DT_SYN, R_NONE, UL "ts_icon_format", 0 }, + /* + */ + {"xterm_title", DT_SYN, R_NONE, UL "ts_status_format", 0 }, + /* + */ + {"xterm_set_titles", DT_SYN, R_NONE, UL "ts_enabled", 0 }, + /* + */ /*--*/ { NULL, 0, 0, 0, 0 } }; diff -r 2ab618f4f6b0 -r 1e935cab6f17 main.c --- a/main.c Tue Oct 22 21:11:55 2013 -0700 +++ b/main.c Wed Oct 23 11:20:24 2013 -0700 @@ -768,6 +768,9 @@ if (!option (OPTNOCURSES)) start_curses (); + /* check whether terminal status is supported (must follow curses init) */ + TSSupported = mutt_ts_capability(); + /* set defaults and read init files */ mutt_init (flags & M_NOSYSRC, commands); mutt_free_list (&commands); diff -r 2ab618f4f6b0 -r 1e935cab6f17 mutt.h --- a/mutt.h Tue Oct 22 21:11:55 2013 -0700 +++ b/mutt.h Wed Oct 23 11:20:24 2013 -0700 @@ -298,6 +298,7 @@ #define SENDMAILX (1<<6) #define SENDKEY (1<<7) #define SENDRESEND (1<<8) +#define SENDPOSTPONEDFCC (1<<9) /* used by mutt_get_postponed() to signal that the x-mutt-fcc header field was present */ /* flags to _mutt_select_file() */ #define M_SEL_BUFFY (1<<0) @@ -431,6 +432,7 @@ OPTTHOROUGHSRC, OPTTHREADRECEIVED, OPTTILDE, + OPTTSENABLED, OPTUNCOLLAPSEJUMP, OPTUSE8BITMIME, OPTUSEDOMAIN, diff -r 2ab618f4f6b0 -r 1e935cab6f17 mutt_menu.h --- a/mutt_menu.h Tue Oct 22 21:11:55 2013 -0700 +++ b/mutt_menu.h Wed Oct 23 11:20:24 2013 -0700 @@ -103,6 +103,9 @@ void menu_current_bottom (MUTTMENU *); void menu_check_recenter (MUTTMENU *); void menu_status_line (char *, size_t, MUTTMENU *, const char *); +short mutt_ts_capability (void); +void mutt_ts_status (char *); +void mutt_ts_icon (char *); MUTTMENU *mutt_new_menu (int); void mutt_menuDestroy (MUTTMENU **); diff -r 2ab618f4f6b0 -r 1e935cab6f17 mutt_ssl_gnutls.c --- a/mutt_ssl_gnutls.c Tue Oct 22 21:11:55 2013 -0700 +++ b/mutt_ssl_gnutls.c Wed Oct 23 11:20:24 2013 -0700 @@ -385,7 +385,15 @@ tlssockdata *data = conn->sockdata; if (data) { - gnutls_bye (data->state, GNUTLS_SHUT_RDWR); + /* shut down only the write half to avoid hanging waiting for the remote to respond. + * + * RFC5246 7.2.1. "Closure Alerts" + * + * It is not required for the initiator of the close to wait for the + * responding close_notify alert before closing the read side of the + * connection. + */ + gnutls_bye (data->state, GNUTLS_SHUT_WR); gnutls_certificate_free_credentials (data->xcred); gnutls_deinit (data->state); @@ -684,6 +692,9 @@ return -1; } +/* + * Returns 0 on failure, nonzero on success. + */ static int tls_check_one_certificate (const gnutls_datum_t *certdata, gnutls_certificate_status certstat, const char* hostname, int idx, int len) @@ -737,7 +748,7 @@ mutt_error (_("Error processing certificate data")); mutt_sleep (2); gnutls_x509_crt_deinit (cert); - return -1; + return 0; } menu = mutt_new_menu (-1); diff -r 2ab618f4f6b0 -r 1e935cab6f17 pager.c --- a/pager.c Tue Oct 22 21:11:55 2013 -0700 +++ b/pager.c Wed Oct 23 11:20:24 2013 -0700 @@ -1812,6 +1812,13 @@ mutt_paddstr (COLS, bn); } NORMAL_COLOR; + if (option(OPTTSENABLED) && TSSupported) + { + menu_status_line (buffer, sizeof (buffer), index, NONULL (TSStatusFormat)); + mutt_ts_status(buffer); + menu_status_line (buffer, sizeof (buffer), index, NONULL (TSIconFormat)); + mutt_ts_icon(buffer); + } } if ((redraw & REDRAW_INDEX) && index) diff -r 2ab618f4f6b0 -r 1e935cab6f17 postpone.c --- a/postpone.c Tue Oct 22 21:11:55 2013 -0700 +++ b/postpone.c Wed Oct 23 11:20:24 2013 -0700 @@ -329,6 +329,12 @@ tmp->next = NULL; mutt_free_list (&tmp); tmp = next; + /* note that x-mutt-fcc was present. we do this because we want to add a + * default fcc if the header was missing, but preserve the request of the + * user to not make a copy if the header field is present, but empty. + * see http://dev.mutt.org/trac/ticket/3653 + */ + code |= SENDPOSTPONEDFCC; } else if ((WithCrypto & APPLICATION_PGP) && (mutt_strncmp ("Pgp:", tmp->data, 4) == 0 /* this is generated @@ -545,8 +551,15 @@ newhdr->content->length = hdr->content->length; mutt_parse_part (fp, newhdr->content); - FREE (&newhdr->env->message_id); - FREE (&newhdr->env->mail_followup_to); /* really? */ + /* If message_id is set, then we are resending a message and don't want + * message_id or mail_followup_to. Otherwise, we are resuming a + * postponed message, and want to keep the mail_followup_to. + */ + if (newhdr->env->message_id != NULL) + { + FREE (&newhdr->env->message_id); + FREE (&newhdr->env->mail_followup_to); + } /* decrypt pgp/mime encoded messages */ diff -r 2ab618f4f6b0 -r 1e935cab6f17 protos.h --- a/protos.h Tue Oct 22 21:11:55 2013 -0700 +++ b/protos.h Wed Oct 23 11:20:24 2013 -0700 @@ -250,6 +250,7 @@ void mutt_stamp_attachment (BODY *a); void mutt_tabs_to_spaces (char *); void mutt_tag_set_flag (int, int); +short mutt_ts_capability (void); void mutt_unblock_signals (void); void mutt_unblock_signals_system (int); void mutt_update_encoding (BODY *a); diff -r 2ab618f4f6b0 -r 1e935cab6f17 send.c --- a/send.c Tue Oct 22 21:11:55 2013 -0700 +++ b/send.c Wed Oct 23 11:20:24 2013 -0700 @@ -1516,7 +1516,7 @@ /* specify a default fcc. if we are in batchmode, only save a copy of * the message if the value of $copy is yes or ask-yes */ - if (!fcc[0] && !(flags & (SENDPOSTPONED)) && (!(flags & SENDBATCH) || (quadoption (OPT_COPY) & 0x1))) + if (!fcc[0] && !(flags & (SENDPOSTPONEDFCC)) && (!(flags & SENDBATCH) || (quadoption (OPT_COPY) & 0x1))) { /* set the default FCC */ if (!msg->env->from) diff -r 2ab618f4f6b0 -r 1e935cab6f17 smime.c --- a/smime.c Tue Oct 22 21:11:55 2013 -0700 +++ b/smime.c Wed Oct 23 11:20:24 2013 -0700 @@ -1546,7 +1546,7 @@ pid_t thepid; int badsig = -1; - long tmpoffset = 0; + LOFF_T tmpoffset = 0; size_t tmplength = 0; int origType = sigbdy->type; char *savePrefix = NULL; @@ -1863,7 +1863,7 @@ char tempfile[_POSIX_PATH_MAX]; STATE s; - long tmpoffset = b->offset; + LOFF_T tmpoffset = b->offset; size_t tmplength = b->length; int origType = b->type; FILE *tmpfp=NULL; diff -r 2ab618f4f6b0 -r 1e935cab6f17 status.c --- a/status.c Tue Oct 22 21:11:55 2013 -0700 +++ b/status.c Wed Oct 23 11:20:24 2013 -0700 @@ -195,6 +195,8 @@ break; case 'P': + if (!menu) + break; if (menu->top + menu->pagelen >= menu->max) cp = menu->top ? "end" : "all"; else diff -r 2ab618f4f6b0 -r 1e935cab6f17 version.sh --- a/version.sh Tue Oct 22 21:11:55 2013 -0700 +++ b/version.sh Wed Oct 23 11:20:24 2013 -0700 @@ -5,7 +5,7 @@ # Switch to directory where this script lives so that further commands are run # from the root directory of the source. The script path and srcdir are double # quoted to allow the space character to appear in the path. -srcdir=$(dirname "$0") && cd "$srcdir" || exit 1 +srcdir=`dirname "$0"` && cd "$srcdir" || exit 1 # Ensure that we have a repo here and that mercurial is installed. If # not, just cat the VERSION file; it contains the latest release number.
