Rocco Rutte:
authorpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Sat, 6 Aug 2005 18:07:10 +0000 (18:07 +0000)
committerpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Sat, 6 Aug 2005 18:07:10 +0000 (18:07 +0000)
- merge in latest mutt changes
- beautify debug level sanity checks

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@371 e385b8ad-14ed-0310-8656-cc95a2468c6d

37 files changed:
ChangeLog.mutt
Makefile.am
UPGRADING
account.c
commands.c
compose.c
config.h.in
configure.in
contrib/Makefile.in
curs_main.c
doc/Makefile.in
doc/manual.sgml.head
doc/manual.txt
doc/mutt.man
globals.h
imap/message.c
imap/mx_imap.c
init.c
init.h
lib/debug.c
lib/debug.h
main.c
mbox.c
mutt.h
mutt_sasl.c
mutt_socket.c
mutt_ssl.c
mutt_ssl.h
mutt_ssl_nss.c
muttlib.c
pager.c
pgp.c
po/Makefile.in.in
po/POTFILES.in
pop/pop_lib.c
protos.h
recvattach.c

index 0f58afe..90a1e38 100644 (file)
@@ -1,3 +1,127 @@
+2005-08-04 01:15:52  Brendan Cully <brendan@kublai.com>  (brendan)
+
+       * compose.c: Don't unlink non-mutt files that would have been
+       unlinked on send if the message is cancelled.
+                                 
+       * account.c: Fix C precedence buglet in getlogin preventing it
+       from actually calling getuser.
+
+2005-08-03 06:51:24  Brendan Cully  <brendan@kublai.com>  (brendan)
+
+       * mutt_ssl.c: Don't double-free X509 certificates. This patch
+       looks wrong, but it isn't.
+                                 
+       * Makefile.am, po/Makefile.in.in, po/POTFILES.in: Remove
+       mutt_ssl_nss.c from POTFILES.in. Also hack the makefiles to build
+       keymap_alldefs.h in $(top_srcdir), since that's where xgettext
+       looks. Not super clean I guess - the other alternative is to sed
+       POTFILES.
+
+       * globals.h, init.c, init.h, mutt.h, mutt_sasl.c, mutt_socket.c,
+       mutt_ssl.h, mutt_ssl_nss.c, pop_lib.c, configure.in: Put moribund
+       NSS support out to pasture.
+
+       * compose.c, mutt.h: In compose menu, detach should be able to
+       unlink files generated by mutt, but not files that existed before.
+
+2005-08-02 05:58:18  Brendan Cully  <brendan@kublai.com>  (brendan)
+
+       * commands.c, pgp.c: More fiddling with PGP results. When
+       rerunning PGP on a message, clear old security result bits to
+       avoid confusing messages like 'decrypt failed; PGP signature
+       successfully verified'.
+
+       * pgp.c: Forget passphrase on PGP/inline decryption error, and
+       improve status line messages.
+
+       * configure.in: Make $docdir relative to $prefix, like the other
+       prefixes.
+
+       * contrib/Makefile.in, doc/Makefile.in: Be more selective about
+       what to remove during uninstall. (closes #1625)
+
+       * pgp.c: Also forget passphrase when encrypt fails, if
+       signing. (closes #1025 again)
+
+       * imap/message.c: Check that the entire message downloaded
+       successfully on fetch, and don't treat a disappearing cache file
+       as fatal. (closes #1483)
+
+       * compose.c: Don't unlink attachments that you've decided not to
+       send. (closes #1328)
+
+       * pgp.c: Bump up size of PgpPass to 1024 from 256. Seems crazy,
+       but it's harmless and it (closes #1207).
+                                 
+       * account.c: Fix password prompt for POP (more authentication ID
+       fallout).
+
+         * doc/manual.sgml.head: Document <backtab> key.
+                                 
+       * pgp.c: Automatically forget PGP passphrase on sign or decrypt
+       error. (closes #1025). Display "successfully decrypted" message
+       instead of nothing. Superseded by signature verification.
+                                 
+       * commands.c, pgp.c: Don't report PGP signature could not be
+       verified unless there really is a signature verification problem
+       (not some other PGP error).
+
+       * Makefile.am: Install system muttrc from the build directory, not
+       the source directory.
+
+       * mbox.c: Restore Sort immediately after sorting by mailbox order
+       in mbox_sync_mailbox. (closes #972)
+
+       * doc/Makefile.in, doc/mutt.man: Insert compile-time paths to
+       system resources into mutt.man. (closes #854)
+
+       * commands.c, protos.h: Report errors occuring in
+       _mutt_save_message. (closes #847)
+
+2005-08-01 07:35:04  Brendan Cully  <brendan@kublai.com>  (brendan)
+
+       * globals.h, mutt.h, mutt_ssl.c, muttlib.c: Cache SSL certificates
+       that have been accepted but not saved until mutt exits. (closes
+       #643). Create mutt_add_list_n for adding non-character data to
+       lists, have mutt_add_list call it.
+
+2005-08-01 04:57:04  Brendan Cully  <brendan@kublai.com>  (brendan)
+
+       * mx.c: Report error creating FCC when writing to IMAP
+       server. Addresses #423.
+
+2005-08-01 01:43:06  Brendan Cully  <brendan@kublai.com>  (brendan)
+
+       * init.c: complete :set mbox_type=<tab>. (closes #1649)
+
+2005-07-30 04:40:45  TAKAHASHI Tamotsu  <ttakah@lapis.plala.or.jp>  (brendan)
+
+       * pager.c: The builtin pager tries to wrap a line for ever if:
+       0) the line contains a space or a tab character followed by a very
+          long word, and 
+       1) M_PAGER_NSKIP flag is passed to it, and
+       2) $smart_wrap is set. (default)
+
+2005-07-30 04:13:07  Vincent Lefevre  <vincent@vinc17.org>  (brendan)
+
+       * curs_main.c, pager.c: When using colors, the status line of the
+       index is displayed in a bright color, even when the prefix
+       "bright" is *not* given in the foreground color. The problem
+       occurs when I have the following additional line:
+         color normal brightwhite black
+       The problem is that BKGDSET's are missing.
+
+2005-07-30 03:59:04  TAKAHASHI Tamotsu  <ttakah@lapis.plala.or.jp>  (brendan)
+
+       * recvattach.c: Don't refuse to delete attachments just because a
+       message has been checked for "traditional" PGP encoding. (closes
+       #2013)
+
+2005-07-29 18:05:50  TAKAHASHI Tamotsu  <ttakah@lapis.plala.or.jp> (brendan)
+
+       * init.c: "nospam foo" causes a segv if you have not set any
+       "spam", because of a null pointer dereference.
+
 2005-07-29 06:45:14  Brendan Cully  <brendan@kublai.com>  (brendan)
 
        * mutt_ssl_gnutls.c: Tweak a poorly-worded error message in the
        * pgp.c: Fix "noconv" handling for the message body when we generate inline
        PGP.
 
-       * charset.c, charset.h, handler.c, muttlib.c, pgp.c: Some hackisch charset handling for text/plain; x-action=pgp-*.  I
-       don't like this stuff, but it's better than nothing.
+       * charset.c, charset.h, handler.c, muttlib.c, pgp.c: Some hackisch
+       charset handling for text/plain; x-action=pgp-*.  I don't like
+       this stuff, but it's better than nothing.
 
 2002/03/26 22:25:48  Thomas Roessler <roessler@does-not-exist.org>
 
        * pgp.c: Change x-action values to "pgp-encrypted", "pgp-signed".
 
-       * contrib/gpg.rc, commands.c, compose.c, crypt.c, handler.c, muttlib.c, pgp.c, protos.h, recvattach.c, sendlib.c: More inline PGP changes.
+       * contrib/gpg.rc, commands.c, compose.c, crypt.c, handler.c,
+       muttlib.c, pgp.c, protos.h, recvattach.c, sendlib.c: More inline
+       PGP changes.
 
-       * pgp.c: Also permit for "action" and "x-action" on the receiving end, just
-       in case we can settle on a joint standard with other MUA developers.
+       * pgp.c: Also permit for "action" and "x-action" on the receiving
+       end, just in case we can settle on a joint standard with other MUA
+       developers.
 
-       * commands.c, crypt.c, handler.c, pgp.c, pgpinvoke.c, sendlib.c: OK, I'm giving up: pgp_create_traditional now creates text/plain;
+       * commands.c, crypt.c, handler.c, pgp.c, pgpinvoke.c, sendlib.c:
+       OK, I'm giving up: pgp_create_traditional now creates text/plain;
        x-mutt-action={pgp-encrypt,pgp-sign}.
 
        * pgpinvoke.c: Fix application/pgp signatures.
 
-       * charset.c, charset.h, gnupgparse.c, handler.c, mbyte.c, rfc2047.c, sendlib.c, charset.c, charset.h, gnupgparse.c, handler.c, mbyte.c, rfc2047.c, sendlib.c: Fix iconv warnings; from Edmund Grimley Evans.
+       * charset.c, charset.h, gnupgparse.c, handler.c, mbyte.c,
+       rfc2047.c, sendlib.c, charset.c, charset.h, gnupgparse.c,
+       handler.c, mbyte.c, rfc2047.c, sendlib.c: Fix iconv warnings; from
+       Edmund Grimley Evans.
 
-       * smime.c: Please use ascii_strcasecmp() if you want to compare ASCII parameter
-       strings.  mutt_strcasecmp() depends on the locale, and detects "i"
-       and "I" as _different_ in Turkish locales.
+       * smime.c: Please use ascii_strcasecmp() if you want to compare
+       ASCII parameter strings.  mutt_strcasecmp() depends on the locale,
+       and detects "i" and "I" as _different_ in Turkish locales.
 
 2002/03/25 11:34:40  Thomas Roessler <roessler@does-not-exist.org>
 
index 3b080f1..04e0322 100644 (file)
@@ -72,7 +72,7 @@ CPPFLAGS=@CPPFLAGS@ -I$(includedir)
 EXTRA_muttng_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c \
        mutt_tunnel.c smime.c pgp.c pgpinvoke.c pgpkey.c \
        pgplib.c sha1.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c \
-       browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c \
+       browser.h mbyte.h remailer.h url.h \
        pgppacket.c mutt_idna.h mutt_libesmtp.c \
        sidebar.h crypt-mod-pgp-classic.c crypt-mod-smime-classic.c
 
@@ -158,7 +158,7 @@ install-data-local: Muttngrc
        elif [ -f $(DESTDIR)$(pkgdatadir)/../Muttngrc ] ; then \
                mv $(DESTDIR)$(pkgdatadir)/../Muttngrc* $(DESTDIR)$(sysconfdir) ; \
        elif [ ! -f $(DESTDIR)$(sysconfdir)/Muttngrc ] ; then \
-               $(INSTALL) -m 644 $(srcdir)/Muttngrc $(DESTDIR)$(sysconfdir) ; \
+               $(INSTALL) -m 644 Muttngrc $(DESTDIR)$(sysconfdir) ; \
        fi
        -if [ ! -f $(DESTDIR)$(sysconfdir)/muttng-mime.types ]; then \
                $(INSTALL) -m 644 $(srcdir)/mime.types $(DESTDIR)$(sysconfdir)/muttng-mime.types; \
index b105417..a88c5b3 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -10,6 +10,11 @@ This document is not the place for verbose documentation; it only offers
 the necessary keywords to look them up in the manual, ChangeLog or other
 sources of information.
 
+2005-08-06:
+
+  Due to merging in changes made to mutt where NSS support was dropped,
+  it's dropped in mutt-ng too.
+
 2005-07-28:
 
   Because of reverting a (overly eager) mutt-ng-specific issue with
index aff9d3a..b96de37 100644 (file)
--- a/account.c
+++ b/account.c
@@ -176,15 +176,18 @@ int mutt_account_getlogin (ACCOUNT* account)
 #ifdef USE_IMAP
   else if (account->type == M_ACCT_TYPE_IMAP)
   {
-    if (ImapLogin)
+    if (ImapLogin) {
       strfcpy (account->login, ImapLogin, sizeof (account->login));
-    else {
-      mutt_account_getuser (account);
-      strfcpy (account->login, account->user, sizeof (account->login));
+      account->flags |= M_ACCT_LOGIN;
     }
   }
 #endif
 
+  if (!(account->flags & M_ACCT_LOGIN)) {
+    mutt_account_getuser (account);
+    strfcpy (account->login, account->user, sizeof (account->login));
+  }
+
   account->flags |= M_ACCT_LOGIN;
 
   return 0;
@@ -211,7 +214,8 @@ int mutt_account_getpass (ACCOUNT * account)
 #endif
   else {
     snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "),
-              account->login, account->host);
+              account->flags & M_ACCT_LOGIN ? account->login : account->user,
+              account->host);
     account->pass[0] = '\0';
     if (mutt_get_password (prompt, account->pass, sizeof (account->pass)))
       return -1;
index c17c0ce..fb62f07 100644 (file)
@@ -164,6 +164,7 @@ int mutt_display_message (HEADER * cur)
 
   if (WithCrypto) {
     /* update crypto information for this message */
+    cur->security &= ~(GOODSIGN|BADSIGN);
     cur->security |= crypt_query (cur->content);
 
     /* Remove color cache for this message, in case there
@@ -196,7 +197,7 @@ int mutt_display_message (HEADER * cur)
       else if (cur->security & PARTSIGN)
         mutt_message (_
                       ("Warning: Part of this message has not been signed."));
-      else
+      else if (cur->security & SIGN)
         mutt_message (_("PGP signature could NOT be verified."));
     }
 
@@ -641,30 +642,31 @@ static void set_copy_flags (HEADER * hdr, int decode, int decrypt,
   }
 }
 
-void _mutt_save_message (HEADER * h, CONTEXT * ctx, int delete, int decode,
-                         int decrypt)
-{
+int _mutt_save_message (HEADER * h, CONTEXT * ctx, int delete, int decode,
+                         int decrypt) {
   int cmflags, chflags;
+  int rc;
 
   set_copy_flags (h, decode, decrypt, &cmflags, &chflags);
 
   if (decode || decrypt)
     mutt_parse_mime_message (Context, h);
 
-  if (mutt_append_message (ctx, Context, h, cmflags, chflags) == 0) {
-    if (delete) {
-      mutt_set_flag (Context, h, M_DELETE, 1);
-      if (option (OPTDELETEUNTAG))
-        mutt_set_flag (Context, h, M_TAG, 0);
-    }
+  if ((rc = mutt_append_message (ctx, Context, h, cmflags, chflags)) != 0)
+    return rc;
+
+  if (delete) {
+    mutt_set_flag (Context, h, M_DELETE, 1);
+    if (option (OPTDELETEUNTAG))
+      mutt_set_flag (Context, h, M_TAG, 0);
     mutt_set_flag (Context, h, M_APPENDED, 1);
   }
+  return (0);
 }
 
 /* returns 0 if the copy/save was successful, or -1 on error/abort */
 int mutt_save_message (HEADER * h, int delete,
-                       int decode, int decrypt, int *redraw)
-{
+                       int decode, int decrypt, int *redraw) {
   int i, need_buffy_cleanup;
   int need_passphrase = 0, app = 0;
   char prompt[SHORT_STRING], buf[_POSIX_PATH_MAX];
@@ -771,15 +773,21 @@ int mutt_save_message (HEADER * h, int delete,
 #endif
 
   if (mx_open_mailbox (buf, M_APPEND, &ctx) != NULL) {
-    if (h)
-      _mutt_save_message (h, &ctx, delete, decode, decrypt);
-    else {
+    if (h) {
+      if (_mutt_save_message (h, &ctx, delete, decode, decrypt) != 0) {
+        mx_close_mailbox (&ctx, NULL);
+        return (-1);
+      }
+    } else {
       for (i = 0; i < Context->vcount; i++) {
         if (Context->hdrs[Context->v2r[i]]->tagged) {
           mutt_message_hook (Context, Context->hdrs[Context->v2r[i]],
                              M_MESSAGEHOOK);
-          _mutt_save_message (Context->hdrs[Context->v2r[i]], &ctx, delete,
-                              decode, decrypt);
+          if (_mutt_save_message (Context->hdrs[Context->v2r[i]], &ctx, delete,
+                                  decode, decrypt) != 0) {
+            mx_close_mailbox (&ctx, NULL);
+            return (-1);
+          }
         }
       }
     }
index 377d60e..aacfd8d 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -801,6 +801,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
           char *att = files[i];
 
           idx[idxlen] = (ATTACHPTR *) safe_calloc (1, sizeof (ATTACHPTR));
+          idx[idxlen]->unowned = 1;
           idx[idxlen]->content = mutt_make_file_attach (att);
           if (idx[idxlen]->content != NULL)
             update_idx (menu, idx, idxlen++);
@@ -954,6 +955,8 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
 
     case OP_DELETE:
       CHECK_COUNT;
+      if (idx[menu->current]->unowned)
+        idx[menu->current]->content->unlink = 0;
       if (delete_attachment (menu, &idxlen, menu->current) == -1)
         break;
       mutt_update_tree (idx, idxlen);
@@ -1278,6 +1281,8 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
           /* avoid freeing other attachments */
           idx[idxlen]->content->next = NULL;
           idx[idxlen]->content->parts = NULL;
+          if (idx[idxlen]->unowned)
+            idx[idxlen]->content->unlink = 0;
           mutt_free_body (&idx[idxlen]->content);
           FREE (&idx[idxlen]->tree);
           FREE (&idx[idxlen]);
index 6a23e2f..e4802a0 100644 (file)
 /* Define to enable the use of libesmtp */
 #undef USE_LIBESMTP
 
-/* Define if you want support for SSL via the NSS library. */
-#undef USE_NSS
-
 /* Define if you want support for the POP3 protocol. */
 #undef USE_POP
 
index 8b26bfd..08240d7 100644 (file)
@@ -465,7 +465,7 @@ AC_SUBST(DOTLOCK_TARGET)
 AC_MSG_CHECKING(where to put the documentation)
 AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]),
         [mutt_cv_docdir=$withval],
-        [mutt_cv_docdir="$mutt_cv_prefix/doc/muttng"])
+        [mutt_cv_docdir="${prefix}/doc/muttng"])
 AC_MSG_RESULT($mutt_cv_docdir)
 
 docdir=$mutt_cv_docdir
@@ -601,31 +601,6 @@ AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl[=PFX]], [Compile in SSL support for
 
         fi
 ])
-AM_CONDITIONAL(USE_SSL, test x$need_ssl = xyes)
-
-dnl SSL support via NSS
-AC_ARG_WITH(nss, AC_HELP_STRING([--with-nss[=PFX]], [Compile in SSL support for POP/IMAP via NSS]),
-[       if test "$with_nss" != no
-        then
-          if test "$need_socket" != "yes"; then
-           AC_MSG_ERROR([SSL support is only useful with POP or IMAP support])
-          fi
-
-          if test "$with_nss" != "yes"
-          then
-           LDFLAGS="$LDFLAGS -L$withval/lib"
-           CPPFLAGS="$CPPFLAGS -I$withval/include -I$withval/public/security"
-          fi
-
-          AC_DEFINE(USE_NSS,1,[ Define if you want support for SSL via the NSS library. ])
-          MUTTLIBS="$MUTTLIBS -lssl -lnss -lcertdb -lcerthi -lcryptohi"
-          MUTTLIBS="$MUTTLIBS -lpk11wrap -lsoftoken -lsecutil -ldbm -lplds4 -lplc4 -lfreebl"
-          MUTTLIBS="$MUTTLIBS -lnspr4"
-
-          MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_nss.o"
-          need_ssl=yes
-        fi
-])
 
 AC_ARG_WITH([gnutls], AC_HELP_STRING([--with-gnutls[=PFX]], [Enable SSL support using gnutls]),
     [gnutls_prefix="$withval"], [gnutls_prefix="no"])
@@ -648,6 +623,8 @@ then
     ])
 fi
 
+AM_CONDITIONAL(USE_SSL, test x$need_ssl = xyes)
+
 AC_ARG_WITH(sasl, AC_HELP_STRING([--with-sasl[=PFX]], [Use Cyrus SASL library for POP/IMAP authentication]),
         [
         if test "$with_sasl" != "no" -a "$need_imap" != "yes" -a "$need_pop" != "yes"
index 9e7eee7..2286433 100644 (file)
@@ -1,5 +1,3 @@
-# $Id: Makefile.in,v 3.3 2003/04/02 08:47:28 roessler Exp $
-
 SHELL = /bin/sh
 
 PACKAGE = @PACKAGE@
@@ -51,6 +49,12 @@ install:
 # Nothing needs to be done - uninstall in doc removes samples as well.
 # This is just so make uninstall doesn't fail.
 uninstall:
+       for f in $(SAMPLES) ; do \
+         rm -f $(DESTDIR)$(docdir)/samples/$$f ; \
+       done
+       -rm -rf $(DESTDIR)$(docdir)/samples/iconv
+       -rmdir $(DESTDIR)$(docdir)/samples
+       -rmdir $(DESTDIR)$(docdir)
 
 maintainer-clean: distclean
 
index 3fe1af9..6943163 100644 (file)
@@ -557,8 +557,10 @@ int mutt_index_menu (void)
         DrawFullLine = 0;
         CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES - 2);
         SETCOLOR (MT_COLOR_STATUS);
+        BKGDSET (MT_COLOR_STATUS);
         mutt_paddstr (COLS, buf);
         SETCOLOR (MT_COLOR_NORMAL);
+        BKGDSET (MT_COLOR_NORMAL);
         sidebar_set_buffystats (Context);
         menu->redraw &= ~REDRAW_STATUS;
         if (option (OPTXTERMSETTITLES)) {
index b3816ea..71dc46f 100644 (file)
@@ -1,5 +1,3 @@
-# $Id: Makefile.in,v 3.7 2005/03/16 07:01:59 brendan Exp $
-
 SHELL = /bin/sh
 
 PACKAGE = @PACKAGE@
@@ -7,6 +5,7 @@ VERSION = @VERSION@
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
+sysconfdir = @sysconfdir@
 bindir = @bindir@
 libdir = @libdir@
 mandir = @mandir@
@@ -63,7 +62,7 @@ srcdir_DOCFILES = PGP-Notes.txt applying-patches.txt  \
 topsrcdir_DOCFILES = COPYRIGHT GPL INSTALL ChangeLog   \
        UPGRADING README NEWS TODO TODO.mutt-ng README.SSL 
 
-all: muttrc.man try-html try-txt
+all: muttng.1 muttrc.man try-html try-txt
 
 try-html: ../makedoc$(EXEEXT)
        test -f manual.html || $(MAKE) manual.html || cp $(srcdir)/manual*.html ./
@@ -74,7 +73,7 @@ try-txt: ../makedoc$(EXEEXT)
 install: all instdoc
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man1
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man5
-       ./instdoc $(srcdir)/mutt.man $(DESTDIR)$(mandir)/man1/muttng.1
+       ./instdoc muttng.1 $(DESTDIR)$(mandir)/man1/muttng.1
        ./instdoc $(srcdir)/muttbug.man $(DESTDIR)$(mandir)/man1/muttng-flea.1
        echo ".so $(mandir)/man1/muttng-flea.1" > $(DESTDIR)$(mandir)/man1/muttngbug.1
        echo ".so $(mandir)/man1/muttng-flea.1" > $(DESTDIR)$(mandir)/man1/fleang.1
@@ -83,12 +82,12 @@ install: all instdoc
        ./instdoc muttrc.man $(DESTDIR)$(mandir)/man5/muttngrc.5
        ./instdoc $(srcdir)/mbox.man $(DESTDIR)$(mandir)/man5/muttng-mbox.5
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(docdir)
-       for f in $(srcdir_DOCFILES) ; do \
-               $(INSTALL) -m 644 $(srcdir)/$$f $(DESTDIR)$(docdir) ; \
-       done
        for f in $(topsrcdir_DOCFILES) ; do \
                $(INSTALL) -m 644 $(top_srcdir)/$$f $(DESTDIR)$(docdir) ; \
        done
+       for f in $(srcdir_DOCFILES) ; do \
+               $(INSTALL) -m 644 $(srcdir)/$$f $(DESTDIR)$(docdir) ; \
+       done
        $(INSTALL) -m 644 manual.txt $(DESTDIR)$(docdir) || true
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(docdir)/html
        for file in manual*.html ; do   \
@@ -96,10 +95,20 @@ install: all instdoc
        done
 
 uninstall:
-       -rm -f $(DESTDIR)$(mandir)/man1/muttng.1
-       -rm -f $(DESTDIR)$(mandir)/man1/muttng_dotlock.1
-       -rm -f $(DESTDIR)$(mandir)/man5/muttngrc.5
-       -rm -rf $(DESTDIR)$(docdir)
+       for f in muttng.1 mutt_dotlock.1 fleang.1 muttng-flea.1 muttngbug.1 ; do \
+         rm -f $(DESTDIR)$(mandir)/man1/$$f ; \
+       done
+       for f in muttngrc.5 muttng-mbox.5  do \
+         rm -f $(DESTDIR)$(mandir)/man5/$$f ; \
+       done
+       for f in $(srcdir_DOCFILES) $(topsrcdir_DOCFILES) ; do \
+         rm -f $(DESTDIR)$(docdir)/$$f ; \
+       done
+       -rm -f $(DESTDIR)$(docdir)/manual.txt
+       for f in manual*.html ; do \
+         rm -f $(DESTDIR)$(docdir)/html/$$f ; \
+       done
+       -rmdir $(DESTDIR)$(docdir)/html
 
 check:
 manual.txt: manual.sgml
@@ -148,11 +157,15 @@ dist distdir: Makefile $(DISTFILES)
 ../makedoc$(EXEEXT): $(top_srcdir)/makedoc.c
        (cd .. && $(MAKE) makedoc$(EXEEXT))
 
-# hack around autoconf mixing up patterns.
-at = @
-
 update-doc:  ../makedoc$(EXEEXT) stamp-doc-sgml stamp-doc-man manual.txt manual.html
 
+EDIT=sed -e 's,@sysconfdir\@,$(sysconfdir),g' \
+     -e 's,@bindir\@,$(bindir),g' \
+     -e 's,@docdir\@,$(docdir),g'
+
+muttng.1: $(srcdir)/mutt.man
+       $(EDIT) $< > $@
+
 muttrc.man stamp-doc-man: ../makedoc$(EXEEXT) $(top_srcdir)/init.h muttrc.man.head muttrc.man.tail
        $(MAKEDOC_CPP) $(top_srcdir)/init.h | ../makedoc -m |       \
                cat $(srcdir)/muttrc.man.head - $(srcdir)/muttrc.man.tail\
@@ -160,7 +173,7 @@ muttrc.man stamp-doc-man: ../makedoc$(EXEEXT) $(top_srcdir)/init.h muttrc.man.he
        touch stamp-doc-man
 
 manual.sgml stamp-doc-sgml: ../makedoc$(EXEEXT) $(top_srcdir)/init.h manual.sgml.head manual.sgml.tail $(top_srcdir)/VERSION
-       ( sed -e "s/$(at)VERSION$(at)/`cat $(top_srcdir)/VERSION`/" $(srcdir)/manual.sgml.head ;\
+       ( sed -e "s/@VERSION\@/`cat $(top_srcdir)/VERSION`/" $(srcdir)/manual.sgml.head ;\
          $(MAKEDOC_CPP) $(top_srcdir)/init.h | ../makedoc -s ) |      \
                cat - $(srcdir)/manual.sgml.tail > manual.sgml
        touch stamp-doc-sgml
index 84f5ae9..3b5ccbd 100644 (file)
@@ -989,6 +989,7 @@ In addition, <em/key/ may consist of:
 <tscreen><verb>
 \t              tab
 <tab>           tab
+<backtab>       backtab / shift-tab
 \r              carriage return
 \n              newline
 \e              escape
index a635dc9..21cbd6f 100644 (file)
@@ -3,7 +3,7 @@
 
                         by Michael Elkins <me@cs.hmc.edu> and others.
 
-                                     version devel-r353
+                                     version devel-r371
 
                                           A\bAb\bbs\bst\btr\bra\bac\bct\bt
 
 
             \t              tab
             <tab>           tab
+            <backtab>       backtab / shift-tab
             \r              carriage return
             \n              newline
             \e              escape
 
        _\b3_\b._\b5  _\bS_\be_\bt_\bt_\bi_\bn_\bg _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be_\bs _\bb_\ba_\bs_\be_\bd _\bu_\bp_\bo_\bn _\bm_\ba_\bi_\bl_\bb_\bo_\bx
 
-       Usage: folder-hook [!]_\br_\be_\bg_\be_\bx_\bp _\bc_\bo_\bm_\bm_\ba_\bn_\bd
-
        The Mutt-ng E-Mail Client                                                    20
 
+       Usage: folder-hook [!]_\br_\be_\bg_\be_\bx_\bp _\bc_\bo_\bm_\bm_\ba_\bn_\bd
+
        It is often desirable to change settings based on which mailbox you are read-
        ing.  The folder-hook command provides a method by which you can execute any
        configuration command.  _\br_\be_\bg_\be_\bx_\bp is a regular expression specifying in which
        The advantage with using function names directly is that the macros will work
        regardless of the current key bindings, so they are not dependent on the user
        having particular key definitions.  This makes them more robust and portable,
-       and also facilitates defining of macros in files used by more than one user
-       (eg. the system Muttngrc).
 
        The Mutt-ng E-Mail Client                                                    21
 
+       and also facilitates defining of macros in files used by more than one user
+       (eg. the system Muttngrc).
+
        Optionally you can specify a descriptive text after _\bs_\be_\bq_\bu_\be_\bn_\bc_\be, which is shown in
        the help screens.
 
 
           +\bo search (highlighting of words in the pager)
 
+       The Mutt-ng E-Mail Client                                                    22
+
           +\bo signature
 
           +\bo status (mode lines used to display info about the mailbox or message)
 
-       The Mutt-ng E-Mail Client                                                    22
-
           +\bo tilde (the ``~'' used to pad blank lines in the pager)
 
           +\bo tree (thread tree drawn in the message index and attachment menu)
        command for it to be removed.  The pattern ``*'' is a special token which means
        to clear the color index list of all entries.
 
+       The Mutt-ng E-Mail Client                                                    23
+
        Mutt-ng also recognizes the keywords _\bc_\bo_\bl_\bo_\br_\b0, _\bc_\bo_\bl_\bo_\br_\b1, ..., _\bc_\bo_\bl_\bo_\brN\bN-\b-1\b1 (N\bN being the
        number of colors supported by your terminal).  This is useful when you remap
        the colors for your display (for example by changing the color associated with
        _\bc_\bo_\bl_\bo_\br_\b2 for your xterm), since color names may then lose their normal meaning.
 
-       The Mutt-ng E-Mail Client                                                    23
-
        If your terminal does not support color, it is still possible change the video
        attributes through the use of the ``mono'' command:
 
             unignore organization organisation x-mailer: x-newsreader: x-mailing-list:
             unignore posted-to:
 
+       The Mutt-ng E-Mail Client                                                    24
+
        _\b3_\b._\b9  _\bA_\bl_\bt_\be_\br_\bn_\ba_\bt_\bi_\bv_\be _\ba_\bd_\bd_\br_\be_\bs_\bs_\be_\bs
 
        Usage: [un]alternates _\br_\be_\bg_\be_\bx_\bp [ _\br_\be_\bg_\be_\bx_\bp ... ]
 
        With various functions, mutt will treat messages differently, depending on
-
-       The Mutt-ng E-Mail Client                                                    24
-
        whether you sent them or whether you received them from someone else.  For
        instance, when replying to a message that you sent to a different party, mutt
        will automatically suggest to send the response to the original message's
 
        You can use regular expressions with both commands.  To mark all messages sent
        to a specific bug report's address on mutt's bug tracking system as list mail,
+
+       The Mutt-ng E-Mail Client                                                    25
+
        for instance, you could say ``subscribe [0-9]*@bugs.guug.de''.  Often, it's
        sufficient to just give a portion of the list's e-mail address.
 
        Specify as much of the address as you need to to remove ambiguity.  For exam-
        ple, if you've subscribed to the Mutt-ng mailing list, you will receive mail
-
-       The Mutt-ng E-Mail Client                                                    25
-
        addressed to _\bm_\bu_\bt_\bt_\b-_\bu_\bs_\be_\br_\bs_\b@_\bm_\bu_\bt_\bt_\b._\bo_\br_\bg.  So, to tell Mutt-ng that this is a mailing
        list, you could add ``lists mutt-users'' to your initialization file.  To tell
        mutt that you are subscribed to it, add ``subscribe mutt-users'' to your ini-
        they do not properly reset the access time.  Backup tools are another common
        reason for updated access times.
 
+       The Mutt-ng E-Mail Client                                                    26
+
        N\bNo\bot\bte\be:\b: the filenames in the mailboxes command are resolved when the command is
        executed, so if these names contain _\bs_\bh_\bo_\br_\bt_\bc_\bu_\bt _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br_\bs (section 4.8  , page
        44) (such as ``='' and ``!''), any variable definition that affect these char-
        acters (like _\b$_\bf_\bo_\bl_\bd_\be_\br (section 6.3.64  , page 79) and _\b$_\bs_\bp_\bo_\bo_\bl_\bf_\bi_\bl_\be (section
-
-       The Mutt-ng E-Mail Client                                                    26
-
        6.3.295  , page 136)) should be executed before the mailboxes command.
 
        _\b3_\b._\b1_\b3  _\bU_\bs_\be_\br _\bd_\be_\bf_\bi_\bn_\be_\bd _\bh_\be_\ba_\bd_\be_\br_\bs
        ``unhdr_order *'' will clear all previous headers from the order list, thus
        removing the header order effects set by the system-wide startup file.
 
-            hdr_order From Date: From: To: Cc: Subject:
-
        The Mutt-ng E-Mail Client                                                    27
 
+            hdr_order From Date: From: To: Cc: Subject:
+
        _\b3_\b._\b1_\b5  _\bS_\bp_\be_\bc_\bi_\bf_\by _\bd_\be_\bf_\ba_\bu_\bl_\bt _\bs_\ba_\bv_\be _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
 
        Usage: save-hook [!]_\bp_\ba_\bt_\bt_\be_\br_\bn _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
 
        Usage: reply-hook [!]_\bp_\ba_\bt_\bt_\be_\br_\bn _\bc_\bo_\bm_\bm_\ba_\bn_\bd
 
+       The Mutt-ng E-Mail Client                                                    28
+
        Usage: send-hook [!]_\bp_\ba_\bt_\bt_\be_\br_\bn _\bc_\bo_\bm_\bm_\ba_\bn_\bd
 
        Usage: send2-hook [!]_\bp_\ba_\bt_\bt_\be_\br_\bn _\bc_\bo_\bm_\bm_\ba_\bn_\bd
 
-       The Mutt-ng E-Mail Client                                                    28
-
        These commands can be used to execute arbitrary configuration commands based
        upon recipients of the message.  _\bp_\ba_\bt_\bt_\be_\br_\bn is a regular expression matching the
        desired address.  _\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed when _\br_\be_\bg_\be_\bx_\bp matches recipients of the
 
        Example:
 
+       The Mutt-ng E-Mail Client                                                    29
+
             message-hook ~A 'set pager=builtin'
             message-hook '~f freshmeat-news' 'set pager="less \"+/^  subject: .*\""'
 
-       The Mutt-ng E-Mail Client                                                    29
-
        _\b3_\b._\b2_\b0  _\bC_\bh_\bo_\bo_\bs_\bi_\bn_\bg _\bt_\bh_\be _\bc_\br_\by_\bp_\bt_\bo_\bg_\br_\ba_\bp_\bh_\bi_\bc _\bk_\be_\by _\bo_\bf _\bt_\bh_\be _\br_\be_\bc_\bi_\bp_\bi_\be_\bn_\bt
 
        Usage: crypt-hook _\bp_\ba_\bt_\bt_\be_\br_\bn _\bk_\be_\by_\bi_\bd
        same pattern specified in the score command for it to be removed.  The pattern
        ``*'' is a special token which means to clear the list of all score entries.
 
+       The Mutt-ng E-Mail Client                                                    30
+
        _\b3_\b._\b2_\b4  _\bS_\bp_\ba_\bm _\bd_\be_\bt_\be_\bc_\bt_\bi_\bo_\bn
 
        Usage: spam _\bp_\ba_\bt_\bt_\be_\br_\bn _\bf_\bo_\br_\bm_\ba_\bt
 
-       The Mutt-ng E-Mail Client                                                    30
-
        Usage: nospam _\bp_\ba_\bt_\bt_\be_\br_\bn
 
        Mutt-ng has generalized support for external spam-scoring filters.  By defining
        expression matches against for _\bs_\be_\ba_\br_\bc_\bh and _\bl_\bi_\bm_\bi_\bt functions. And it's what sort-
        ing by spam attribute will use as a sort key.
 
+       The Mutt-ng E-Mail Client                                                    31
+
        That's a pretty complicated example, and most people's actual environments will
        have only one spam filter. The simpler your configuration, the more effective
        mutt can be, especially when it comes to sorting.
 
-       The Mutt-ng E-Mail Client                                                    31
-
        Generally, when you sort by spam tag, mutt will sort _\bl_\be_\bx_\bi_\bc_\ba_\bl_\bl_\by -- that is, by
        ordering strings alphnumerically. However, if a spam tag begins with a number,
        mutt will sort numerically first, and lexically only when two numbers are equal
        be enclosed in quotes if they contain spaces or tabs.  You may also use the
        ``C'' escape sequences \\b\n\bn and \\b\t\bt for newline and tab, respectively.
 
-       _\bq_\bu_\ba_\bd_\bo_\bp_\bt_\bi_\bo_\bn variables are used to control whether or not to be prompted for cer-
-       tain actions, or to specify a default action.  A value of _\by_\be_\bs will cause the
-       action to be carried out automatically as if you had answered yes to the
-
        The Mutt-ng E-Mail Client                                                    32
 
-       question.  Similarly, a value of _\bn_\bo will cause the the action to be carried out
-       as if you had answered ``no.''  A value of _\ba_\bs_\bk_\b-_\by_\be_\bs will cause a prompt with a
+       _\bq_\bu_\ba_\bd_\bo_\bp_\bt_\bi_\bo_\bn variables are used to control whether or not to be prompted for cer-
+       tain actions, or to specify a default action.  A value of _\by_\be_\bs will cause the
+       action to be carried out automatically as if you had answered yes to the ques-
+       tion.  Similarly, a value of _\bn_\bo will cause the the action to be carried out as
+       if you had answered ``no.''  A value of _\ba_\bs_\bk_\b-_\by_\be_\bs will cause a prompt with a
        default answer of ``yes'' and _\ba_\bs_\bk_\b-_\bn_\bo will provide a default answer of ``no.''
 
        Prefixing a variable with ``no'' will unset it.  Example: set noaskbcc.
 
        Usage: ifdef _\bi_\bt_\be_\bm _\bc_\bo_\bm_\bm_\ba_\bn_\bd
 
+       The Mutt-ng E-Mail Client                                                    33
+
        Usage: ifndef _\bi_\bt_\be_\bm _\bc_\bo_\bm_\bm_\ba_\bn_\bd
 
        These commands allow testing for a variable, function or certain feature being
-
-       The Mutt-ng E-Mail Client                                                    33
-
        available or not respectively, before actually executing the command given.
 
        ifdef (short for ``if defined'') only executes the command upon availability
 
        _\b4_\b.  _\bA_\bd_\bv_\ba_\bn_\bc_\be_\bd _\bU_\bs_\ba_\bg_\be
 
-       _\b4_\b._\b1  _\bR_\be_\bg_\bu_\bl_\ba_\br _\bE_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\bs
-
-       All string patterns in Mutt-ng including those in more complex _\bp_\ba_\bt_\bt_\be_\br_\bn_\bs
-
        The Mutt-ng E-Mail Client                                                    34
 
-       (section 4.2  , page 36) must be specified using regular expressions (regexp)
-       in the ``POSIX extended'' syntax (which is more or less the syntax used by
-       egrep and GNU awk).  For your convenience, we have included below a brief
-       description of this syntax.
+       _\b4_\b._\b1  _\bR_\be_\bg_\bu_\bl_\ba_\br _\bE_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\bs
+
+       All string patterns in Mutt-ng including those in more complex _\bp_\ba_\bt_\bt_\be_\br_\bn_\bs (sec-
+       tion 4.2  , page 36) must be specified using regular expressions (regexp) in
+       the ``POSIX extended'' syntax (which is more or less the syntax used by egrep
+       and GNU awk).  For your convenience, we have included below a brief description
+       of this syntax.
 
        The search is case sensitive if the pattern contains at least one upper case
        letter, and case insensitive otherwise. Note that ``\'' must be quoted if used
              [:blank:]
                    Space or tab characters.
 
+       The Mutt-ng E-Mail Client                                                    35
+
              [:cntrl:]
                    Control characters.
 
-       The Mutt-ng E-Mail Client                                                    35
-
              [:digit:]
                    Numeric characters.
 
        A regular expression matching a single character may be followed by one of sev-
        eral repetition operators:
 
+       The Mutt-ng E-Mail Client                                                    36
+
              ?
                    The preceding item is optional and matched at most once.
 
-       The Mutt-ng E-Mail Client                                                    36
-
              *
                    The preceding item will be matched zero or more times.
 
                    Matches any word-constituent character (letter, digit, or under-
                    score).
 
+       The Mutt-ng E-Mail Client                                                    37
+
              \\W
                    Matches any character that is not word-constituent.
 
-       The Mutt-ng E-Mail Client                                                    37
-
              \\`
                    Matches the empty string at the beginning of a buffer (string).
 
 
        Default: '~/.mutt_certificates'
 
-       Availability: SSL or NSS or GNUTLS
+       Availability: SSL or GNUTLS
 
        This variable specifies the file where the certificates you trust are saved.
        When an unknown certificate is encountered, you are asked if you accept it or
 
        Default: ''
 
-       Availability: SSL or NSS
+       Availability: SSL
 
        The file which includes random data that is used to initialize SSL library
        functions.
 
        Default: yes
 
-       Availability: SSL or NSS
+       Availability: SSL
 
        This variables specifies whether to attempt to use SSLv2 in the SSL authentica-
        tion process.
 
        Default: yes
 
-       Availability: SSL or NSS or GNUTLS
+       Availability: SSL or GNUTLS
 
        This variables specifies whether to attempt to use SSLv3 in the SSL authentica-
        tion process.
 
        Default: yes
 
-       Availability: SSL or NSS or GNUTLS
+       Availability: SSL or GNUTLS
 
        This variables specifies whether to attempt to use TLSv1 in the SSL authentica-
        tion process.
 
        Default: yes
 
-       Availability: SSL or NSS
+       Availability: SSL
 
        If set to _\by_\be_\bs, Mutt-ng will use CA certificates in the system-wide certificate
 
            3.6   Keyboard macros .................................................. 20
            3.7   Using color and mono video attributes ............................ 21
            3.8   Ignoring (weeding) unwanted message headers ...................... 23
-           3.9   Alternative addresses ............................................ 23
+           3.9   Alternative addresses ............................................ 24
            3.10  Mailing lists .................................................... 24
            3.11  Using Multiple spool mailboxes ................................... 25
            3.12  Defining mailboxes which receive mail ............................ 25
            3.21  Adding key sequences to the keyboard buffer ...................... 29
            3.22  Executing functions .............................................. 29
            3.23  Message Scoring .................................................. 29
-           3.24  Spam detection ................................................... 29
+           3.24  Spam detection ................................................... 30
            3.25  Setting variables ................................................ 31
            3.26  Reading initialization commands from another file ................ 32
            3.27  Configuring features conditionally ............................... 32
            3.28  Removing hooks ................................................... 33
 
        4.  Advanced Usage ......................................................... 33
-           4.1   Regular Expressions .............................................. 33
+           4.1   Regular Expressions .............................................. 34
 
                                               i
 
index b3ceca3..0aaf193 100644 (file)
@@ -1,7 +1,7 @@
 .\" -*-nroff-*-
 .\"
 .\"
-.\"     Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
+.\"     Copyright (C) 1996-2004 Michael R. Elkins <me@cs.hmc.edu>
 .\" 
 .\"     This program is free software; you can redistribute it and/or modify
 .\"     it under the terms of the GNU General Public License as published by
@@ -147,21 +147,21 @@ Specifies the editor to use when composing messages.
 .PP
 .IP "~/.muttngrc or ~/.muttng/muttngrc"
 User configuration file.
-.IP "/etc/Muttngrc"
+.IP "@sysconfdir@/Muttngrc"
 System-wide configuration file.
 .IP "/tmp/muttXXXXXX"
 Temporary files created by Mutt-ng.
 .IP "~/.mailcap"
 User definition for handling non-text MIME types.
-.IP "/etc/mailcap"
+.IP "@sysconfdir@/mailcap"
 System definition for handling non-text MIME types.
 .IP "~/.mime.types"
 User's personal mapping between MIME types and file extensions.
-.IP "/etc/mime.types"
+.IP "@sysconfdir@/mime.types"
 System mapping between MIME types and file extensions.
-.IP "/usr/local/bin/muttng_dotlock"
+.IP "@bindir@/muttng_dotlock"
 The privileged dotlocking program.
-.IP "/usr/local/doc/muttng/manual.txt"
+.IP "@docdir@/manual.txt"
 The Mutt-ng manual.
 .SH BUGS
 .PP
index 850e5aa..e5df1df 100644 (file)
--- a/globals.h
+++ b/globals.h
@@ -148,14 +148,15 @@ WHERE unsigned short SmtpPort;
 WHERE char *Spoolfile;
 WHERE char *SpamSep;
 
-#if defined(USE_SSL) || defined(USE_NSS) || defined(USE_GNUTLS)
+#if defined(USE_SSL) || defined(USE_GNUTLS)
 WHERE char *SslCertFile INITVAL (NULL);
 #endif
-#if defined(USE_SSL) || defined(USE_NSS)
+#if defined(USE_SSL)
 WHERE char *SslEntropyFile INITVAL (NULL);
 #endif
 #ifdef USE_SSL
 WHERE char *SslClientCert INITVAL (NULL);
+WHERE LIST *SslSessionCerts INITVAL (NULL);
 #endif
 #ifdef USE_GNUTLS
 WHERE short SslDHPrimeBits;
index 4291713..6e6314d 100644 (file)
@@ -335,16 +335,10 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
   cache = &idata->cache[cacheno];
 
   if (cache->path) {
-    if (cache->uid == HEADER_DATA (h)->uid) {
-      /* yes, so just return a pointer to the message */
-      if (!(msg->fp = fopen (cache->path, "r"))) {
-        mutt_perror (cache->path);
-        return (-1);
-      }
+    /* don't treat cache errors as fatal, just fall back. */
+    if (cache->uid == HEADER_DATA(h)->uid && (msg->fp = fopen (cache->path, "r")))
       return 0;
-    }
     else {
-      /* clear the previous entry */
       unlink (cache->path);
       FREE (&cache->path);
     }
@@ -423,6 +417,12 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
   /* see comment before command start. */
   h->active = 1;
 
+  fflush (msg->fp);
+  if (ferror (msg->fp)) {
+    mutt_perror (cache->path);
+    goto bail;
+  }
+
   if (rc != IMAP_CMD_OK)
     goto bail;
 
index 26ee476..4ad4bbb 100644 (file)
@@ -38,8 +38,10 @@ static int imap_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr)
   char tmp[_POSIX_PATH_MAX];
 
   mutt_mktemp (tmp);
-  if ((msg->fp = safe_fopen (tmp, "w")) == NULL)
+  if ((msg->fp = safe_fopen (tmp, "w")) == NULL) {
+    mutt_perror (tmp);
     return (-1);
+  }
   msg->path = safe_strdup (tmp);
   return 0;
 }
diff --git a/init.c b/init.c
index 079ecc7..0d7bbbe 100644 (file)
--- a/init.c
+++ b/init.c
@@ -21,7 +21,7 @@
 #include "mutt_crypt.h"
 #include "mutt_idna.h"
 
-#if defined(USE_SSL) || defined(USE_NSS) || defined(USE_GNUTLS)
+#if defined(USE_SSL) || defined(USE_GNUTLS)
 #include "mutt_ssl.h"
 #endif
 
@@ -429,6 +429,8 @@ static int remove_from_spam_list (SPAM_LIST ** list, const char *pat)
 
   /* Being first is a special case. */
   spam = *list;
+  if (!spam)
+    return 0;
   if (spam->rx && !mutt_strcmp (spam->rx->pattern, pat)) {
     *list = spam->next;
     rx_free (&spam->rx);
@@ -1938,6 +1940,26 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
                   "reverse-" : "",
                   (*((short *) MuttVars[idx].data) & SORT_LAST) ? "last-" :
                   "", p);
+      } 
+      else if (DTYPE (MuttVars[idx].type) == DT_MAGIC) {
+        char *p;
+        switch (DefaultMagic) {
+          case M_MBOX:
+            p = "mbox";
+            break;
+          case M_MMDF:
+            p = "MMDF";
+            break;
+          case M_MH:
+            p = "MH";
+          break;
+          case M_MAILDIR:
+            p = "Maildir";
+            break;
+          default:
+            p = "unknown";
+        }
+        strfcpy (tmp, p, sizeof (tmp));
       }
       else if (DTYPE (MuttVars[idx].type) == DT_BOOL)
         strfcpy (tmp, option (MuttVars[idx].data) ? "yes" : "no",
diff --git a/init.h b/init.h
index 874e423..4e78663 100644 (file)
--- a/init.h
+++ b/init.h
@@ -2387,7 +2387,7 @@ struct option_t MuttVars[] = {
    ** servers will probably desire 587, the mail submission port.
    */
 #endif
-#if defined(USE_SSL)||defined(USE_NSS)||defined(USE_GNUTLS)
+#if defined(USE_SSL) || defined(USE_GNUTLS)
 #ifdef USE_SSL
   {"ssl_client_cert", DT_PATH, R_NONE, UL &SslClientCert, 0},
   /*
@@ -2414,7 +2414,7 @@ struct option_t MuttVars[] = {
   {"certificate_file", DT_PATH, R_NONE, UL &SslCertFile, UL "~/.mutt_certificates"},
   /*
    ** .pp
-   ** Availability: SSL or NSS or GNUTLS
+   ** Availability: SSL or GNUTLS
    **
    ** .pp
    ** This variable specifies the file where the certificates you trust
@@ -2433,7 +2433,7 @@ struct option_t MuttVars[] = {
   {"ssl_usesystemcerts", DT_BOOL, R_NONE, OPTSSLSYSTEMCERTS, 1},
   /*
    ** .pp
-   ** Availability: SSL or NSS
+   ** Availability: SSL
    **
    ** .pp
    ** If set to \fIyes\fP, Mutt-ng will use CA certificates in the
@@ -2443,7 +2443,7 @@ struct option_t MuttVars[] = {
   {"entropy_file", DT_PATH, R_NONE, UL &SslEntropyFile, 0},
   /*
    ** .pp
-   ** Availability: SSL or NSS
+   ** Availability: SSL
    **
    ** .pp
    ** The file which includes random data that is used to initialize SSL
@@ -2452,7 +2452,7 @@ struct option_t MuttVars[] = {
   {"ssl_use_sslv2", DT_BOOL, R_NONE, OPTSSLV2, 1},
   /*
    ** .pp
-   ** Availability: SSL or NSS
+   ** Availability: SSL
    **
    ** .pp
    ** This variables specifies whether to attempt to use SSLv2 in the
@@ -2462,7 +2462,7 @@ struct option_t MuttVars[] = {
   {"ssl_use_sslv3", DT_BOOL, R_NONE, OPTSSLV3, 1},
   /*
    ** .pp
-   ** Availability: SSL or NSS or GNUTLS
+   ** Availability: SSL or GNUTLS
    **
    ** .pp
    ** This variables specifies whether to attempt to use SSLv3 in the
@@ -2471,7 +2471,7 @@ struct option_t MuttVars[] = {
   {"ssl_use_tlsv1", DT_BOOL, R_NONE, OPTTLSV1, 1},
   /*
    ** .pp
-   ** Availability: SSL or NSS or GNUTLS
+   ** Availability: SSL or GNUTLS
    **
    ** .pp
    ** This variables specifies whether to attempt to use TLSv1 in the
index ddf6284..5136175 100644 (file)
@@ -35,7 +35,8 @@ void debug_start (const char* basedir) {
   char buf[_POSIX_PATH_MAX];
   char buf2[_POSIX_PATH_MAX];
 
-  if (DebugLevel < 0 || !basedir || !*basedir)
+  if (DebugLevel < DEBUG_MIN_LEVEL || DebugLevel > DEBUG_MAX_LEVEL
+      || !basedir || !*basedir)
     return;
   /* rotate the old debug logs */
   for (i = 3; i >= 0; i--) {
@@ -53,7 +54,7 @@ void debug_start (const char* basedir) {
 }
 
 void _debug_print_intro (const char* file, int line, const char* function, int level) {
-  if (!DebugFile || DebugLevel < 0)
+  if (!DebugFile || DebugLevel < DEBUG_MIN_LEVEL || DebugLevel > DEBUG_MAX_LEVEL)
     return;
   fprintf (DebugFile, "[%d:%s:%d", level, NONULL(file), line);
   if (function && *function)
index 225aff5..61a1411 100644 (file)
 
 #include <stdio.h>
 
+#define DEBUG_MIN_LEVEL         1
+#define DEBUG_MIN_LEVEL_S       "1"
+#define DEBUG_MAX_LEVEL         5
+#define DEBUG_MAX_LEVEL_S       "5"
+
 #ifdef DEBUG
 
 extern short DebugLevel;
diff --git a/main.c b/main.c
index 550b7d1..826602c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -581,10 +581,11 @@ int main (int argc, char **argv)
     case 'd':
       debug_setlevel(atoi(optarg));
 #ifdef DEBUG
-      if (atoi(optarg)<=3 && atoi(optarg)>=0)
+      if (atoi(optarg) < DEBUG_MIN_LEVEL && atoi(optarg) > DEBUG_MAX_LEVEL)
         printf (_("Debugging at level %d.\n"), atoi(optarg));
       else {
-        printf(_("Please specify a valid debugging level (0-3).\n"));
+        printf(_("Please specify a valid debugging level ("
+                 DEBUG_MIN_LEVEL_S "-" DEBUG_MAX_LEVEL_S ").\n"));
         return 1;
       }
 #else
diff --git a/mbox.c b/mbox.c
index d3ecea5..1cd5a0c 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -564,6 +564,8 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint)
     save_sort = Sort;
     Sort = SORT_ORDER;
     mutt_sort_headers (ctx, 0);
+    Sort = save_sort;
+    need_sort = 1;
   }
 
   /* need to open the file for writing in such a way that it does not truncate
@@ -593,11 +595,9 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint)
     rc = i;
     goto bail;
   }
-  else if (i < 0) {
+  else if (i < 0)
     /* fatal error */
-    Sort = save_sort;
     return (-1);
-  }
 
   /* Create a temporary file to write the new version of the mailbox in. */
   mutt_mktemp (tempfile);
@@ -811,8 +811,6 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint)
     mutt_unblock_signals ();
     mx_fastclose_mailbox (ctx);
     mutt_error _("Fatal error!  Could not reopen mailbox!");
-
-    Sort = save_sort;
     return (-1);
   }
 
@@ -829,7 +827,6 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint)
   FREE (&oldOffset);
   unlink (tempfile);            /* remove partial copy of the mailbox */
   mutt_unblock_signals ();
-  Sort = save_sort;             /* Restore the default value. */
 
   return (0);                   /* signal success */
 
@@ -862,12 +859,10 @@ bail:                          /* Come here in case of disaster */
     return (-1);
   }
 
-  if (need_sort || save_sort != Sort) {
-    Sort = save_sort;
+  if (need_sort)
     /* if the mailbox was reopened, the thread tree will be invalid so make
      * sure to start threading from scratch.  */
     mutt_sort_headers (ctx, (need_sort == M_REOPENED));
-  }
 
   return rc;
 }
diff --git a/mutt.h b/mutt.h
index f2c5dfa..91c9999 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -386,7 +386,7 @@ enum {
   OPTIMAPFORCESSL,
 # endif
 #endif
-#if defined(USE_SSL) || defined(USE_NSS) || defined(USE_GNUTLS)
+#if defined(USE_SSL) || defined(USE_GNUTLS)
 # ifndef USE_GNUTLS
   OPTSSLV2,
 # endif
@@ -587,7 +587,8 @@ LIST *mutt_copy_list (LIST *);
 int mutt_matches_ignore (const char *, LIST *);
 
 /* add an element to a list */
-LIST *mutt_add_list (LIST *, const char *);
+LIST *mutt_add_list (LIST*, const char*);
+LIST *mutt_add_list_n (LIST*, const void*, size_t len);
 
 void mutt_init (int, LIST *);
 
@@ -893,6 +894,7 @@ typedef struct attachptr {
   char *tree;
   int level;
   int num;
+  unsigned int unowned:1;       /* don't unlink on detach */
 } ATTACHPTR;
 
 typedef struct {
index de8b9de..b4d200c 100644 (file)
@@ -243,8 +243,8 @@ int mutt_sasl_client_new (CONNECTION * conn, sasl_conn_t ** saslconn)
 
   /*** set sasl IP properties, necessary for use with krb4 ***/
   /* Do we need to fail if this fails? I would assume having these unset
-   * would just disable KRB4. Who wrote this code? I'm not sure how this
-   * interacts with the NSS code either, since that mucks with the fd. */
+   * would just disable KRB4. Who wrote this code?
+   */
 #ifndef USE_SASL2               /* with SASLv2 this all happens in sasl_client_new */
   {
     struct sockaddr_in local, remote;
@@ -288,10 +288,6 @@ int mutt_sasl_client_new (CONNECTION * conn, sasl_conn_t ** saslconn)
     return -1;
   }
 
-  /* we currently don't have an SSF finder for NSS (I don't know the API).
-   * If someone does it'd probably be trivial to write mutt_nss_get_ssf().
-   * I have a feeling more SSL code could be shared between those two files,
-   * but I haven't looked into it yet, since I still don't know the APIs. */
 #if defined(USE_SSL) || defined(USE_GNUTLS)
   if (conn->ssf) {
 #ifdef USE_SASL2                /* I'm not sure this actually has an effect, at least with SASLv2 */
index a38534c..acb544a 100644 (file)
@@ -17,7 +17,7 @@
 #include "globals.h"
 #include "mutt_socket.h"
 #include "mutt_tunnel.h"
-#if defined(USE_SSL) || defined(USE_GNUTLS) || defined(USE_NSS)
+#if defined(USE_SSL) || defined(USE_GNUTLS)
 # include "mutt_ssl.h"
 #endif
 
@@ -239,8 +239,6 @@ CONNECTION *mutt_conn_find (const CONNECTION * start, const ACCOUNT * account)
   else if (account->flags & M_ACCT_SSL) {
 #ifdef USE_SSL
     ssl_socket_setup (conn);
-#elif USE_NSS
-    mutt_nss_socket_setup (conn);
 #elif USE_GNUTLS
     if (mutt_gnutls_socket_setup (conn) < 0) {
       mutt_socket_free (conn);
index 020cd1d..9092c33 100644 (file)
@@ -343,8 +343,9 @@ static int ssl_socket_close (CONNECTION * conn)
 
   if (data) {
     SSL_shutdown (data->ssl);
-
+#if 0
     X509_free (data->cert);
+#endif
     SSL_free (data->ssl);
     SSL_CTX_free (data->ctx);
     FREE (&conn->sockdata);
@@ -353,6 +354,46 @@ static int ssl_socket_close (CONNECTION * conn)
   return raw_socket_close (conn);
 }
 
+static int compare_certificates (X509 *cert, X509 *peercert, 
+                                 unsigned char *peermd,
+                                 unsigned int peermdlen) {
+  unsigned char md[EVP_MAX_MD_SIZE];
+  unsigned int mdlen;
+
+  /* Avoid CPU-intensive digest calculation if the certificates are
+  * not even remotely equal.
+  */
+  if (X509_subject_name_cmp (cert, peercert) != 0 || 
+      X509_issuer_name_cmp (cert, peercert) != 0)
+    return -1;
+
+  if (!X509_digest (cert, EVP_sha1(), md, &mdlen) || peermdlen != mdlen)
+    return -1;
+
+  if (memcmp(peermd, md, mdlen) != 0)
+    return -1;
+
+  return 0;
+}
+
+static int check_certificate_cache (X509 *peercert) {
+  unsigned char peermd[EVP_MAX_MD_SIZE];
+  unsigned int peermdlen;
+  X509 *cert;
+  LIST *scert;
+
+  if (!X509_digest (peercert, EVP_sha1(), peermd, &peermdlen)) 
+    return 0;
+
+  for (scert = SslSessionCerts; scert; scert = scert->next) {
+    cert = *(X509**)scert->data;
+    if (!compare_certificates (cert, peercert, peermd, peermdlen)) {
+      return 1;
+    }
+  }
+ return 0;
+}
+
 static int tls_close (CONNECTION * conn)
 {
   int rc;
@@ -501,24 +542,9 @@ static int check_certificate_by_digest (X509 * peercert)
   }
 
   while ((cert = READ_X509_KEY (fp, &cert)) != NULL) {
-    unsigned char md[EVP_MAX_MD_SIZE];
-    unsigned int mdlen;
-
-    /* Avoid CPU-intensive digest calculation if the certificates are
-     * not even remotely equal.
-     */
-    if (X509_subject_name_cmp (cert, peercert) != 0 ||
-        X509_issuer_name_cmp (cert, peercert) != 0)
-      continue;
-
-    if (!X509_digest (cert, EVP_sha1 (), md, &mdlen) || peermdlen != mdlen)
-      continue;
-
-    if (memcmp (peermd, md, mdlen) != 0)
-      continue;
-
-    pass = 1;
-    break;
+    pass = compare_certificates (cert, peercert, peermd, peermdlen) ? 0 : 1;
+    if (pass)
+      break;
   }
   X509_free (cert);
   fclose (fp);
@@ -536,6 +562,12 @@ static int ssl_check_certificate (sslsockdata * data)
   FILE *fp;
   char *name = NULL, *c;
 
+  /* check session cache first */
+  if (check_certificate_cache (data->cert)) {
+    debug_print (1, ("ssl_check_certificate: using cached certificate\n"));
+    return 1;
+  }
+
   if (check_certificate_by_signer (data->cert)) {
     debug_print (1, ("signer check passed\n"));
     return 1;
@@ -635,6 +667,10 @@ static int ssl_check_certificate (sslsockdata * data)
       /* fall through */
     case OP_MAX + 2:           /* accept once */
       done = 2;
+      /* keep a handle on accepted certificates in case we want to
+       * open up another connection to the same server in this session */
+      SslSessionCerts = mutt_add_list_n (SslSessionCerts, &data->cert,
+                                         sizeof (X509 **));
       break;
     }
   }
index 1a55566..26fe2ca 100644 (file)
@@ -22,7 +22,4 @@ int mutt_gnutls_starttls (CONNECTION * conn);
 
 extern int mutt_gnutls_socket_setup (CONNECTION * conn);
 #endif
-#ifdef USE_NSS
-int mutt_nss_socket_setup (CONNECTION * conn);
-#endif
 #endif /* _MUTT_SSL_H_ */
index 863f969..e69de29 100644 (file)
@@ -1,353 +0,0 @@
-/*
- * Copyright notice from original mutt:
- * Copyright (C) 2000 Michael R. Elkins <me@mutt.org>
- *
- * This file is part of mutt-ng, see http://www.muttng.org/.
- * It's licensed under the GNU General Public License,
- * please see the file GPL in the top level source directory.
- */
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <prinit.h>
-#include <pk11func.h>
-#include <prtypes.h>
-#include <prio.h>
-#include <prnetdb.h>
-#include "nss.h"
-#include "ssl.h"
-#include "sechash.h"
-#include "cert.h"
-#include "cdbhdl.h"
-#include "mutt.h"
-#include "mutt_socket.h"
-#include "mutt_curses.h"
-
-#include "lib/mem.h"
-#include "lib/intl.h"
-
-static int MuttNssInitialized = 0;
-
-/* internal data struct we use with the CONNECTION.  this is where NSS-specific
- * data gets stuffed so that the main mutt_socket.h doesn't have to be
- * modified.
- */
-typedef struct {
-  PRFileDesc *fd;
-  CERTCertDBHandle *db;
-} mutt_nss_t;
-
-/* nss callback to grab the user's password. */
-static char *mutt_nss_password_func (PK11SlotInfo * slot, PRBool retry,
-                                     void *arg)
-{
-  return NULL;
-}
-
-static int mutt_nss_error (const char *call)
-{
-  mutt_error (_("%s failed (error %d)"), call, PR_GetError ());
-  return -1;
-}
-
-/* initialize the NSS library for use.  must be called prior to any other
- * functions in this module.
- */
-static int mutt_nss_init (void)
-{
-  if (!MuttNssInitialized) {
-    PK11_SetPasswordFunc (mutt_nss_password_func);
-    if (NSS_Init (SslCertFile) == SECFailure)
-      return mutt_nss_error ("NSS_Init");
-
-    /* always use strong crypto. */
-    if (NSS_SetDomesticPolicy () == SECFailure)
-      return mutt_nss_error ("NSS_SetDomesticPolicy");
-
-    /* intialize the session cache */
-    SSL_ClearSessionCache ();
-
-    MuttNssInitialized = 1;
-  }
-  return 0;
-}
-
-/* convert from int64 to a readable string and print on the screen */
-static void mutt_nss_pretty_time (int64 usecs)
-{
-  struct tm t;
-  PRExplodedTime ex;
-  char timebuf[128];
-
-  PR_ExplodeTime (usecs, PR_LocalTimeParameters, &ex);
-
-  t.tm_sec = ex.tm_sec;
-  t.tm_min = ex.tm_min;
-  t.tm_hour = ex.tm_hour;
-  t.tm_mday = ex.tm_mday;
-  t.tm_mon = ex.tm_month;
-  t.tm_year = ex.tm_year - 1900;        /* PRExplodedTime uses the absolute year */
-  t.tm_wday = ex.tm_wday;
-  t.tm_yday = ex.tm_yday;
-
-  strfcpy (timebuf, asctime (&t), sizeof (timebuf));
-  timebuf[mutt_strlen (timebuf) - 1] = 0;
-
-  addstr (timebuf);
-}
-
-/* this function is called by the default hook CERT_AuthCertificate when it
- * can't verify a cert based upon the contents of the user's certificate
- * database.  we are given the option to override the decision and accept
- * it anyway.
- */
-static SECStatus mutt_nss_bad_cert (void *arg, PRFileDesc * fd)
-{
-  PRErrorCode err;
-  CERTCertificate *cert, *issuer;
-  unsigned char hash[16];
-  int i;
-  CERTCertTrust trust;
-  int64 not_before, not_after;
-  event_t ch;
-  char status[256];
-
-  /* first lets see why this certificate failed.  we only want to override
-   * in the case where the cert was not found.
-   */
-  err = PR_GetError ();
-  mutt_error (_("SSL_AuthCertificate failed (error %d)"), err);
-
-  /* fetch the cert in question */
-  cert = SSL_PeerCertificate (fd);
-
-  move (LINES - 8, 0);
-  clrtoeol ();
-  move (LINES - 7, 0);
-  clrtoeol ();
-  addstr ("Issuer:      ");
-  addstr (CERT_NameToAscii (&cert->issuer));
-  move (LINES - 6, 0);
-  clrtoeol ();
-  addstr ("Subject:     ");
-  addstr (CERT_NameToAscii (&cert->subject));
-
-  move (LINES - 5, 0);
-  clrtoeol ();
-  addstr ("Valid:       ");
-  CERT_GetCertTimes (cert, &not_before, &not_after);
-  mutt_nss_pretty_time (not_before);
-  addstr (" to ");
-  mutt_nss_pretty_time (not_after);
-
-  move (LINES - 4, 0);
-  clrtoeol ();
-  addstr ("Fingerprint: ");
-
-  /* calculate the MD5 hash of the raw certificate */
-  HASH_HashBuf (HASH_AlgMD5, hash, cert->derCert.data, cert->derCert.len);
-  for (i = 0; i < 16; i++) {
-    printw ("%0x", hash[i]);
-    if (i != 15)
-      addch (':');
-  }
-
-  mvaddstr (LINES - 3, 0, "Signature:   ");
-  clrtoeol ();
-
-  /* find the cert which signed this cert */
-  issuer = CERT_FindCertByName ((CERTCertDBHandle *) arg, &cert->derIssuer);
-
-  /* verify the sig (only) if we have the issuer cert handy */
-  if (issuer &&
-      CERT_VerifySignedData (&cert->signatureWrap, issuer, PR_Now (), NULL)
-      == SECSuccess)
-    addstr ("GOOD");
-  else
-    addstr ("BAD");
-
-  move (LINES - 2, 0);
-  SETCOLOR (MT_COLOR_STATUS);
-  memset (status, ' ', sizeof (status) - 1);
-  if (COLS < sizeof (status))
-    status[COLS - 1] = 0;
-  else
-    status[sizeof (status) - 1] = 0;
-  memcpy (status, "--- SSL Certificate Check",
-          sizeof ("--- SSL Certificate Check") - 1);
-  addstr (status);
-  clrtoeol ();
-  SETCOLOR (MT_COLOR_NORMAL);
-
-  for (;;) {
-    mvaddstr (LINES - 1, 0, "(r)eject, accept (o)nce, (a)lways accept?");
-    clrtoeol ();
-    ch = mutt_getch ();
-    if (ch.ch == -1) {
-      i = SECFailure;
-      break;
-    }
-    else if (ascii_tolower (ch.ch) == 'r') {
-      i = SECFailure;
-      break;
-    }
-    else if (ascii_tolower (ch.ch) == 'o') {
-      i = SECSuccess;
-      break;
-    }
-    else if (ascii_tolower (ch.ch) == 'a') {
-      /* push this certificate onto the user's certificate store so it
-       * automatically becomes valid next time we see it
-       */
-
-      /* set this certificate as a valid peer for SSL-auth ONLY. */
-      CERT_DecodeTrustString (&trust, "P,,");
-
-      CERT_AddTempCertToPerm (cert, NULL, &trust);
-      i = SECSuccess;
-      break;
-    }
-    BEEP ();
-  }
-
-  /* SSL_PeerCertificate() returns a copy with an updated ref count, so
-   * we have to destroy our copy here.
-   */
-  CERT_DestroyCertificate (cert);
-
-  return i;
-}
-
-static int mutt_nss_socket_open (CONNECTION * con)
-{
-  mutt_nss_t *sockdata;
-  PRNetAddr addr;
-  struct hostent *he;
-
-  memset (&addr, 0, sizeof (addr));
-  addr.inet.family = AF_INET;
-  addr.inet.port = PR_htons (con->account.port);
-  he = gethostbyname (con->account.host);
-  if (!he) {
-    mutt_error (_("Unable to find ip for host %s"), con->account.host);
-    return -1;
-  }
-  addr.inet.ip = *((int *) he->h_addr_list[0]);
-
-  sockdata = safe_calloc (1, sizeof (mutt_nss_t));
-
-  do {
-    sockdata->fd = PR_NewTCPSocket ();
-    if (sockdata->fd == NULL) {
-      mutt_error (_("PR_NewTCPSocket failed."));
-      break;
-    }
-    /* make this a SSL socket */
-    sockdata->fd = SSL_ImportFD (NULL, sockdata->fd);
-
-    /* set SSL version options based upon user's preferences */
-    if (!option (OPTTLSV1))
-      SSL_OptionSet (sockdata->fd, SSL_ENABLE_TLS, PR_FALSE);
-
-    if (!option (OPTSSLV2))
-      SSL_OptionSet (sockdata->fd, SSL_ENABLE_SSL2, PR_FALSE);
-
-    if (!option (OPTSSLV3))
-      SSL_OptionSet (sockdata->fd, SSL_ENABLE_SSL3, PR_FALSE);
-
-    /* set the host we were attempting to connect to in order to verify
-     * the name in the certificate we get back.
-     */
-    if (SSL_SetURL (sockdata->fd, con->account.host)) {
-      mutt_nss_error ("SSL_SetURL");
-      break;
-    }
-
-    /* we don't need no stinking pin.  we don't authenticate ourself
-     * via SSL.
-     */
-    SSL_SetPKCS11PinArg (sockdata->fd, 0);
-
-    sockdata->db = CERT_GetDefaultCertDB ();
-
-    /* use the default supplied hook.  it takes an argument to our
-     * certificate database.  the manual lies, you can't really specify
-     * NULL for the callback to get the default!
-     */
-    SSL_AuthCertificateHook (sockdata->fd, SSL_AuthCertificate, sockdata->db);
-    /* set the callback to be used when SSL_AuthCertificate() fails.  this
-     * allows us to override and insert the cert back into the db
-     */
-    SSL_BadCertHook (sockdata->fd, mutt_nss_bad_cert, sockdata->db);
-
-    if (PR_Connect (sockdata->fd, &addr, PR_INTERVAL_NO_TIMEOUT) ==
-        PR_FAILURE) {
-      mutt_error (_("Unable to connect to host %s"), con->account.host);
-      break;
-    }
-
-    /* store the extra info in the CONNECTION struct for later use. */
-    con->sockdata = sockdata;
-
-    /* HACK.  some of the higher level calls in mutt_socket.c depend on this
-     * being >0 when we are in the connected state.  we just set this to
-     * an arbitrary value to avoid hitting that bug, since we neve have the
-     * real fd.
-     */
-    con->fd = 42;
-
-    /* success */
-    return 0;
-  }
-  while (0);
-
-  /* we get here when we had an oops.  clean up the mess. */
-
-  if (sockdata) {
-    if (sockdata->fd)
-      PR_Close (sockdata->fd);
-    if (sockdata->db)
-      CERT_ClosePermCertDB (sockdata->db);
-    FREE (&sockdata);
-  }
-  return -1;
-}
-
-static int mutt_nss_socket_close (CONNECTION * con)
-{
-  mutt_nss_t *sockdata = (mutt_nss_t *) con->sockdata;
-
-  if (PR_Close (sockdata->fd) == PR_FAILURE)
-    return -1;
-
-  if (sockdata->db)
-    CERT_ClosePermCertDB (sockdata->db);
-  /* free up the memory we used for this connection specific to NSS. */
-  FREE (&con->sockdata);
-  return 0;
-}
-
-static int mutt_nss_socket_read (CONNECTION * conn, char *buf, size_t len)
-{
-  return PR_Read (((mutt_nss_t *) conn->sockdata)->fd, buf, len);
-}
-
-static int
-mutt_nss_socket_write (CONNECTION * con, const char *buf, size_t count)
-{
-  return PR_Write (((mutt_nss_t *) con->sockdata)->fd, buf, count);
-}
-
-/* initialize a new connection for use with NSS */
-int mutt_nss_socket_setup (CONNECTION * con)
-{
-  if (mutt_nss_init ())
-    return -1;
-  con->conn_open = mutt_nss_socket_open;
-  con->conn_read = mutt_nss_socket_read;
-  con->conn_write = mutt_nss_socket_write;
-  con->conn_close = mutt_nss_socket_close;
-  return 0;
-}
index 94c7816..c52c58b 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -214,19 +214,25 @@ void mutt_free_parameter (PARAMETER ** p)
   *p = 0;
 }
 
-LIST *mutt_add_list (LIST * head, const char *data)
-{
+LIST *mutt_add_list (LIST * head, const char *data) {
+  size_t len = mutt_strlen (data);
+  return (mutt_add_list_n (head, data, len ? len + 1 : 0));
+}
+
+LIST *mutt_add_list_n (LIST *head, const void *data, size_t len) {
   LIST *tmp;
 
   for (tmp = head; tmp && tmp->next; tmp = tmp->next);
+
   if (tmp) {
     tmp->next = safe_malloc (sizeof (LIST));
     tmp = tmp->next;
-  }
-  else
+  } else
     head = tmp = safe_malloc (sizeof (LIST));
 
-  tmp->data = safe_strdup (data);
+  tmp->data = safe_malloc (len);
+  if (len)
+    memcpy (tmp->data, data, len);
   tmp->next = NULL;
   return head;
 }
diff --git a/pager.c b/pager.c
index 2c831cc..9d5444c 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -1245,7 +1245,11 @@ display_line (FILE * f, long *last_pos, struct line_t **lineInfo, int n,
         /* skip trailing blanks */
         while (ch && (buf[ch] == ' ' || buf[ch] == '\t' || buf[ch] == '\r'))
           ch--;
-        cnt = ch + 1;
+        /* a very long word with leading spaces causes infinite wrapping */
+        if ((!ch) && (flags & M_PAGER_NSKIP))
+          buf_ptr = buf + cnt;
+        else
+          cnt = ch + 1;
       }
       else
         buf_ptr = buf + cnt;    /* a very long word... */
@@ -1650,9 +1654,11 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
       move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)),
             option (OPTSTATUSONTOP) ? 0 : SidebarWidth);
       SETCOLOR (MT_COLOR_STATUS);
+      BKGDSET (MT_COLOR_STATUS);
       mutt_paddstr (COLS - (option (OPTSTATUSONTOP) ? 0 : SidebarWidth),
                     buffer);
       SETCOLOR (MT_COLOR_NORMAL);
+      BKGDSET (MT_COLOR_NORMAL);
     }
     /* if we're not using the index, update every time */
     if (index == 0)
diff --git a/pgp.c b/pgp.c
index 062ee27..a2ad019 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -58,7 +58,7 @@
 #include "mutt_menu.h"
 
 
-char PgpPass[STRING];
+char PgpPass[LONG_STRING];
 time_t PgpExptime = 0;          /* when does the cached passphrase expire? */
 
 void pgp_void_passphrase (void)
@@ -358,12 +358,16 @@ void pgp_application_pgp_handler (BODY * m, STATE * s)
             if (rc == -1 || rv)
               maybe_goodsig = 0;
 
-            state_putc ('\n', s);
             state_attach_puts (_("[-- End of PGP output --]\n\n"), s);
           }
         }
       }
 
+      /* treat empty result as sign of failure */
+      if (! ftell(pgpout)) {
+        mutt_error _("Could not decrypt PGP message");
+        goto out;
+      }
 
       /*
        * Now, copy cleartext to the screen.  NOTE - we expect that PGP
@@ -399,22 +403,16 @@ void pgp_application_pgp_handler (BODY * m, STATE * s)
 
       if (s->flags & M_DISPLAY) {
         state_putc ('\n', s);
-        if (needpass)
+        if (needpass) {
           state_attach_puts (_("[-- END PGP MESSAGE --]\n"), s);
+          mutt_message _("PGP message successfully decrypted.");
+        }
         else if (pgp_keyblock)
           state_attach_puts (_("[-- END PGP PUBLIC KEY BLOCK --]\n"), s);
         else
           state_attach_puts (_("[-- END PGP SIGNED MESSAGE --]\n"), s);
       }
 
-      if (tmpfp) {
-        safe_fclose (&tmpfp);
-        mutt_unlink (tmpfname);
-      }
-      if (pgpout) {
-        safe_fclose (&pgpout);
-        mutt_unlink (outfile);
-      }
     }
     else {
       /* XXX - we may wish to recode here */
@@ -424,8 +422,18 @@ void pgp_application_pgp_handler (BODY * m, STATE * s)
     }
   }
 
+out:
   m->goodsig = (maybe_goodsig && have_any_sigs);
 
+  if (tmpfp) {
+    safe_fclose (&tmpfp);
+    mutt_unlink (tmpfname);
+  }
+  if (pgpout) {
+    safe_fclose (&pgpout);
+    mutt_unlink (outfile);
+  }
+
   if (needpass == -1) {
     state_attach_puts (_
                        ("[-- Error: could not find beginning of PGP message! --]\n\n"),
@@ -691,6 +699,7 @@ BODY *pgp_decrypt_part (BODY * a, STATE * s, FILE * fpout, BODY * p)
   char pgperrfile[_POSIX_PATH_MAX];
   char pgptmpfile[_POSIX_PATH_MAX];
   pid_t thepid;
+  int rv;
 
   mutt_mktemp (pgperrfile);
   if ((pgperr = safe_fopen (pgperrfile, "w+")) == NULL) {
@@ -744,14 +753,16 @@ BODY *pgp_decrypt_part (BODY * a, STATE * s, FILE * fpout, BODY * p)
   }
 
   fclose (pgpout);
-  mutt_wait_filter (thepid);
+  rv = mutt_wait_filter (thepid);
   mutt_unlink (pgptmpfile);
 
   if (s->flags & M_DISPLAY) {
     fflush (pgperr);
     rewind (pgperr);
-    if (pgp_copy_checksig (pgperr, s->fpout) == 0 && p)
+    if (pgp_copy_checksig (pgperr, s->fpout) == 0 && !rv && p)
       p->goodsig = 1;
+    else
+      p->goodsig = 0;
     state_attach_puts (_("[-- End of PGP output --]\n\n"), s);
   }
   fclose (pgperr);
@@ -874,7 +885,10 @@ void pgp_encrypted_handler (BODY * a, STATE * s)
     }
 
     mutt_free_body (&tattach);
-  }
+    /* clear 'Invoking...' message, since there's no error */
+    mutt_message _("PGP message successfully decrypted.");
+  } else
+    mutt_error _("Could not decrypt PGP message");
 
   fclose (fpout);
   mutt_unlink (tempfile);
@@ -1214,6 +1228,8 @@ BODY *pgp_encrypt_message (BODY * a, char *keylist, int sign)
 
   if (empty) {
     /* fatal error while trying to encrypt message */
+    if (sign)
+      pgp_void_passphrase (); /* just in case */
     unlink (tempfile);
     return (NULL);
   }
@@ -1380,6 +1396,8 @@ BODY *pgp_traditional_encryptsign (BODY * a, int flags, char *keylist)
     mutt_any_key_to_continue (NULL);
 
   if (empty) {
+    if (flags & SIGN)
+      pgp_void_passphrase (); /* just in case */
     unlink (pgpoutfile);
     return NULL;
   }
index 0c6c869..a6160fa 100644 (file)
@@ -77,8 +77,8 @@ all: all-@USE_NLS@
 all-yes: $(CATALOGS)
 all-no:
 
-.PHONY: ../keymap_alldefs.h
-../keymap_alldefs.h:
+.PHONY: $(top_srcdir)/keymap_alldefs.h
+$(top_srcdir)/keymap_alldefs.h:
        cd .. && $(MAKE) keymap_alldefs.h
 
 # Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot',
index e9101e0..0b1b149 100644 (file)
@@ -44,7 +44,6 @@ muttlib.c
 mutt_socket.c
 mutt_ssl.c
 mutt_ssl_gnutls.c
-mutt_ssl_nss.c
 mutt_tunnel.c
 mx.c
 nntp/newsrc.c
index 2880de5..9e7d4e4 100644 (file)
@@ -260,7 +260,7 @@ pop_query_status pop_open_connection (POP_DATA * pop_data)
     return PQ_ERR;
   }
 
-#if (defined(USE_SSL) || defined(USE_GNUTLS)) && !defined(USE_NSS)
+#if (defined(USE_SSL) || defined(USE_GNUTLS))
   /* Attempt STLS if available and desired. */
   if (pop_data->cmd_stls && !pop_data->conn->ssf) {
     if (pop_data->use_stls == 0) {
index 69fecdd..684ffd1 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -348,7 +348,7 @@ int mutt_print_attachment (FILE *, BODY *);
 int mutt_query_complete (char *, size_t);
 int mutt_query_variables (LIST * queries);
 int mutt_save_attachment (FILE *, BODY *, char *, int, HEADER *);
-void _mutt_save_message (HEADER *, CONTEXT *, int, int, int);
+int _mutt_save_message (HEADER *, CONTEXT *, int, int, int);
 int mutt_save_message (HEADER *, int, int, int, int *);
 int mutt_search_command (int, int);
 int mutt_skipchars (const char *, const char *);
index f65c4e1..b9237f8 100644 (file)
@@ -1077,7 +1077,7 @@ void mutt_view_attachments (HEADER * hdr)
       }
 #endif
 
-      if (WithCrypto && hdr->security) {
+      if (WithCrypto && (hdr->security & (~PGP_TRADITIONAL_CHECKED))) {
         mutt_message
           _
           ("Deletion of attachments from encrypted messages is unsupported.");