Re: [Mutt] #3259: should be able to delete certain attachments in crypted mail

2012-10-24 Thread Mutt
#3259: should be able to delete certain attachments in crypted mail
--+-
 Reporter:  antonio@… |   Owner:  mutt-dev
 Type:  enhancement   |  Status:  new 
 Priority:  minor |   Milestone:  
Component:  mutt  | Version:  
 Keywords:|  
--+-
Changes (by hlein):

 * cc: hlein@… (added)


Comment:

 Bump.  Sometimes I'll get emails with large (MBs) of attachments.  Once I
 verify the PGP signature and save the attachments to disk, I don't need
 them in my inbox any more.  However, I do want to keep the record
 that/when they emailed, and any text they included in the body.

 I understand that deleting attachments from a signed email would break the
 signature.  Ideally mutt would re-sign the message to myself with my own
 key.

 Similarly if the email were encrypted, Mutt can't just slice some bits out
 of it; it wouldn't decrypt any more.  So instead, Mutt would have to call
 gpg to re-encrypt the content that was preserved.

-- 
Ticket URL: 
Mutt 
The Mutt mail user agent



Re: [PATCH] Make imap_free_header_data type-safe

2012-10-24 Thread Andrew Gaul
Any comments about this patch?  This cleans up a bunch of unneeded
casts.

On Sun, Sep 09, 2012 at 08:00:38PM -0700, Andrew Gaul wrote:
> # HG changeset patch
> # User Andrew Gaul 
> # Date 1347245686 25200
> # Branch HEAD
> # Node ID 4fa799cbf296ebd8fc7ce0eacb05807fcfa30c4d
> # Parent  70810a88ce9feb66d5c74e7ec3f2a633bd8b5312
> Make imap_free_header_data type-safe
> 
> Also push conditional into function for safety and consistency with
> other free functions.
> 
> diff -r 70810a88ce9f -r 4fa799cbf296 imap/imap_private.h
> --- a/imap/imap_private.h Sun Jul 22 11:15:30 2012 -0700
> +++ b/imap/imap_private.h Sun Sep 09 19:54:46 2012 -0700
> @@ -256,7 +256,8 @@
>  
>  /* message.c */
>  void imap_add_keywords (char* s, HEADER* keywords, LIST* mailbox_flags, 
> size_t slen);
> -void imap_free_header_data (void** data);
> +struct imap_header_data;
> +void imap_free_header_data (struct imap_header_data** data);
>  int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend);
>  char* imap_set_flags (IMAP_DATA* idata, HEADER* h, char* s);
>  int imap_cache_del (IMAP_DATA* idata, HEADER* h);
> diff -r 70810a88ce9f -r 4fa799cbf296 imap/message.c
> --- a/imap/message.c  Sun Jul 22 11:15:30 2012 -0700
> +++ b/imap/message.c  Sun Sep 09 19:54:46 2012 -0700
> @@ -160,8 +160,7 @@
>  rc = imap_cmd_step (idata);
>  if (rc != IMAP_CMD_CONTINUE)
>   {
> -  /* suppress GCC aliasing warning */
> -   imap_free_header_data ((void**) (void*) &h.data);
> +   imap_free_header_data (&h.data);
>break;
>   }
>  
> @@ -173,7 +172,7 @@
>continue;
>  else if (mfhrc < 0)
>   {
> -   imap_free_header_data ((void**) (void*) &h.data);
> +   imap_free_header_data (&h.data);
>break;
>   }
>  
> @@ -209,7 +208,7 @@
>  {
> /* bad header in the cache, we'll have to refetch. */
>dprint (3, (debugfile, "bad cache entry at %d, giving up\n", h.sid 
> - 1));
> -  imap_free_header_data((void**) (void*) &h.data);
> +  imap_free_header_data(&h.data);
>evalhc = 0;
>idx--;
>  }
> @@ -219,8 +218,7 @@
>  break;
>if ((mfhrc < -1) || ((rc != IMAP_CMD_CONTINUE) && (rc != IMAP_CMD_OK)))
>{
> -if (h.data)
> -  imap_free_header_data ((void**) (void*) &h.data);
> +imap_free_header_data (&h.data);
>  imap_hcache_close (idata);
>   goto error_out_1;
>}
> @@ -337,8 +335,7 @@
>  
>  if ((mfhrc < -1) || ((rc != IMAP_CMD_CONTINUE) && (rc != IMAP_CMD_OK)))
>  {
> -  if (h.data)
> -imap_free_header_data ((void**) (void*) &h.data);
> +  imap_free_header_data (&h.data);
>  #if USE_HCACHE
>imap_hcache_close (idata);
>  #endif
> @@ -1019,12 +1016,14 @@
>  }
>  
>  /* imap_free_header_data: free IMAP_HEADER structure */
> -void imap_free_header_data (void** data)
> +void imap_free_header_data (IMAP_HEADER_DATA** data)
>  {
> -  /* this should be safe even if the list wasn't used */
> -  mutt_free_list (&(((IMAP_HEADER_DATA*) *data)->keywords));
> +  if (data) {
> +/* this should be safe even if the list wasn't used */
> +mutt_free_list (&((*data)->keywords));
>  
> -  FREE (data);   /* __FREE_CHECKED__ */
> +FREE (data); /* __FREE_CHECKED__ */
> +  }
>  }
>  
>  /* imap_set_flags: fill out the message header according to the flags from

-- 
Andrew Gaul
http://gaul.org/


Re: [PATCH] Guard against NULL dereference in mutt_parent_message

2012-10-24 Thread Andrew Gaul
Any comments about this patch?  This addresses a crash for me.

On Sun, Sep 23, 2012 at 10:29:57PM -0700, Andrew Gaul wrote:
> # HG changeset patch
> # User Andrew Gaul 
> # Date 1348464567 25200
> # Branch HEAD
> # Node ID 3d3f1fb09ef6dcb52393e4d68b0a8d1e2242efea
> # Parent  70810a88ce9feb66d5c74e7ec3f2a633bd8b5312
> Guard against NULL dereference in mutt_parent_message
> 
> Seen when switching IMAP accounts:
> 
> Program terminated with signal 11, Segmentation fault.
> #0  0x0048dbfa in mutt_parent_message (ctx=0x2cb9870, hdr=0x0)
> at thread.c:1087
> 1087  for (thread = hdr->thread->parent; thread; thread = thread->parent)
> 
> (gdb) bt
> #0  0x0048dbfa in mutt_parent_message (ctx=0x2cb9870, hdr=0x0)
> at thread.c:1087
> #1  0x004236a9 in resort_index (menu=0x271bed0) at curs_main.c:396
> #2  0x0042384e in mutt_index_menu () at curs_main.c:456
> #3  0x00449b13 in main (argc=1, argv=0x7fff68a4e528) at main.c:1020
> 
> (gdb) print hdr
> $1 = (HEADER *) 0x0
> 
> diff -r 70810a88ce9f -r 3d3f1fb09ef6 thread.c
> --- a/thread.cSun Jul 22 11:15:30 2012 -0700
> +++ b/thread.cSun Sep 23 22:29:27 2012 -0700
> @@ -1078,6 +1078,10 @@
>  {
>THREAD *thread;
>  
> +  if (hdr == NULL) {
> +goto out;
> +  }
> +
>if ((Sort & SORT_MASK) != SORT_THREADS)
>{
>  mutt_error _("Threading is not enabled.");
> @@ -1097,7 +1101,8 @@
>}
>  }
>}
> -  
> +
> +out:
>mutt_error _("Parent message is not available.");
>return (-1);
>  }

-- 
Andrew Gaul
http://gaul.org/