mutt: Fix parent_hdr usage in mutt_attach_reply(). (see #3728)

2017-08-11 Thread Brendan Cully
changeset: 7129:1306ee5f4bf7
user:  Kevin McCarthy 
date:  Fri Aug 11 09:04:48 2017 -0700
link:  http://dev.mutt.org/hg/mutt/rev/1306ee5f4bf7

Fix parent_hdr usage in mutt_attach_reply(). (see #3728)

If the selected attachments are not messages and no (common) parent is
found, parent_hdr is set to the passed in hdr.  In that case, parent
will still be NULL, but parent_hdr and parent_fp will be set.

Change the test to parent_hdr being NULL, not parent, to check for
this case.

diffs (30 lines):

diff -r 052ad4fcdd6b -r 1306ee5f4bf7 recvcmd.c
--- a/recvcmd.c Thu Aug 10 18:18:28 2017 -0700
+++ b/recvcmd.c Fri Aug 11 09:04:48 2017 -0700
@@ -874,7 +874,7 @@
   tmphdr->env = mutt_new_envelope ();
 
   if (attach_reply_envelope_defaults (tmphdr->env, actx,
- parent ? parent_hdr : (cur ? cur->hdr : 
NULL), flags) == -1)
+ parent_hdr ? parent_hdr : (cur ? cur->hdr 
: NULL), flags) == -1)
   {
 mutt_free_header ();
 return;
@@ -888,7 +888,7 @@
 return;
   }
 
-  if (!parent)
+  if (!parent_hdr)
   {
 if (cur)
   attach_include_reply (fp, tmpfp, cur->hdr, flags);
@@ -961,7 +961,7 @@
   safe_fclose ();
   
   if (ci_send_message (flags, tmphdr, tmpbody, NULL,
- parent ? parent_hdr : (cur ? cur->hdr : NULL)) == 0)
+ parent_hdr ? parent_hdr : (cur ? cur->hdr : NULL)) == 
0)
 mutt_set_flag (Context, hdr, MUTT_REPLIED, 1);
 }
 


Re: [Mutt] #3728: unable to view encrypted multipart attachments

2017-08-11 Thread Mutt
#3728: unable to view encrypted multipart attachments
-+-
  Reporter:  rejozenger  |  Owner:  mutt-dev
  Type:  defect  | Status:  closed
  Priority:  minor   |  Milestone:
 Component:  crypto  |Version:  1.5.23
Resolution:  fixed   |   Keywords:  attachements, encryption,
 |  multipart/encrypted
-+-

Comment (by Kevin McCarthy ):

 In [changeset:"1306ee5f4bf7846a53d555fdaa2667e946b12c13"
 7129:1306ee5f4bf7]:
 {{{
 #!CommitTicketReference repository=""
 revision="1306ee5f4bf7846a53d555fdaa2667e946b12c13"
 Fix parent_hdr usage in mutt_attach_reply(). (see #3728)

 If the selected attachments are not messages and no (common) parent is
 found, parent_hdr is set to the passed in hdr.  In that case, parent
 will still be NULL, but parent_hdr and parent_fp will be set.

 Change the test to parent_hdr being NULL, not parent, to check for
 this case.
 }}}

--
Ticket URL: 
Mutt 
The Mutt mail user agent



Re: [Mutt] #3728: unable to view encrypted multipart attachments

2017-08-11 Thread Mutt
#3728: unable to view encrypted multipart attachments
-+-
  Reporter:  rejozenger  |  Owner:  mutt-dev
  Type:  defect  | Status:  new
  Priority:  minor   |  Milestone:
 Component:  crypto  |Version:  1.5.23
Resolution:  |   Keywords:  attachements, encryption,
 |  multipart/encrypted
-+-

Comment (by Kevin McCarthy ):

 In [changeset:"c7fe290bc3a36c2ee6a9760058de0d4b920cbb62"
 7124:c7fe290bc3a3]:
 {{{
 #!CommitTicketReference repository=""
 revision="c7fe290bc3a36c2ee6a9760058de0d4b920cbb62"
 Add virtual index to actx. (see #3728)

 The virtual index is modeled after the CONTEXT.  Add a CURATTACH
 helper to reduce code verbosity.  Store the actx as menu->data.

 Simplify and consolidate the recvattach and compose menu update code
 inside a function.

 Because compose and recvattach share so much code, change compose to
 use the virtual index even though it has no collapse/expand
 functionality.
 }}}

--
Ticket URL: 
Mutt 
The Mutt mail user agent



Re: [Mutt] #3728: unable to view encrypted multipart attachments

2017-08-11 Thread Mutt
#3728: unable to view encrypted multipart attachments
-+-
  Reporter:  rejozenger  |  Owner:  mutt-dev
  Type:  defect  | Status:  new
  Priority:  minor   |  Milestone:
 Component:  crypto  |Version:  1.5.23
Resolution:  |   Keywords:  attachements, encryption,
 |  multipart/encrypted
-+-

Comment (by Kevin McCarthy ):

 In [changeset:"278b6efc6bbab54b485d6b9f11dfce534ec64598"
 7120:278b6efc6bba]:
 {{{
 #!CommitTicketReference repository=""
 revision="278b6efc6bbab54b485d6b9f11dfce534ec64598"
 Create ATTACH_CONTEXT to hold attachment index. (see #3728)

 Move the idx and idxlen into ATTACH_CONTEXT.  In subsequence patches,
 this structure will hold more useful items, such as the virtual index.

 The swap out is straightforward, except for:
   * update_idx() in compose.c, which post-increments the idxlen in the
 call and again in the function.
   * mutt_gen_attach_list() which doesn't need to returns the new values.
 }}}

--
Ticket URL: 
Mutt 
The Mutt mail user agent



Re: [Mutt] #3728: unable to view encrypted multipart attachments

2017-08-11 Thread Mutt
#3728: unable to view encrypted multipart attachments
-+-
  Reporter:  rejozenger  |  Owner:  mutt-dev
  Type:  defect  | Status:  new
  Priority:  minor   |  Milestone:
 Component:  crypto  |Version:  1.5.23
Resolution:  |   Keywords:  attachements, encryption,
 |  multipart/encrypted
-+-

Comment (by Kevin McCarthy ):

 In [changeset:"b8bbccd9863232cbca7d2568b6d43192040ec315"
 7121:b8bbccd98632]:
 {{{
 #!CommitTicketReference repository=""
 revision="b8bbccd9863232cbca7d2568b6d43192040ec315"
 Change helpers functions to pass actx. (see #3728)

 Change the pager, compose, recvattach and recvcmd to pass the actx
 instead of the individual idx and idxlen parameters.

 Separate out the compose menu exit logic to first free the BODY data
 and then call the shared actx free function at the bottom.
 }}}

--
Ticket URL: 
Mutt 
The Mutt mail user agent



Re: [Mutt] #3728: unable to view encrypted multipart attachments

2017-08-11 Thread Mutt
#3728: unable to view encrypted multipart attachments
-+-
  Reporter:  rejozenger  |  Owner:  mutt-dev
  Type:  defect  | Status:  new
  Priority:  minor   |  Milestone:
 Component:  crypto  |Version:  1.5.23
Resolution:  |   Keywords:  attachements, encryption,
 |  multipart/encrypted
-+-

Comment (by Kevin McCarthy ):

 In [changeset:"e6e8b2f1fae3471a2179df9fa11b9ac48e408543"
 7126:e6e8b2f1fae3]:
 {{{
 #!CommitTicketReference repository=""
 revision="e6e8b2f1fae3471a2179df9fa11b9ac48e408543"
 Fix shared attachment functions. (see #3728)

 With nested decryption, the correct FP is associated with the
 ATTACHPTR entry.  Also, the BODY entries are not continguous, so the
 functions need to iterate over the actx index, not the BODY structure.
 }}}

--
Ticket URL: 
Mutt 
The Mutt mail user agent



Re: [Mutt] #3728: unable to view encrypted multipart attachments

2017-08-11 Thread Mutt
#3728: unable to view encrypted multipart attachments
-+-
  Reporter:  rejozenger  |  Owner:  mutt-dev
  Type:  defect  | Status:  new
  Priority:  minor   |  Milestone:
 Component:  crypto  |Version:  1.5.23
Resolution:  |   Keywords:  attachements, encryption,
 |  multipart/encrypted
-+-

Comment (by Kevin McCarthy ):

 In [changeset:"38855dc0a02a75d90327e51cb2bbca6b5bb8c65f"
 7127:38855dc0a02a]:
 {{{
 #!CommitTicketReference repository=""
 revision="38855dc0a02a75d90327e51cb2bbca6b5bb8c65f"
 Fix attachment check_traditional and extract_keys operations. (see #3728)

 Add helpers and iterate over the actx->idx instead of the BODY structure.
 }}}

--
Ticket URL: 
Mutt 
The Mutt mail user agent



Re: [Mutt] #3728: unable to view encrypted multipart attachments

2017-08-11 Thread Mutt
#3728: unable to view encrypted multipart attachments
-+-
  Reporter:  rejozenger  |  Owner:  mutt-dev
  Type:  defect  | Status:  new
  Priority:  minor   |  Milestone:
 Component:  crypto  |Version:  1.5.23
Resolution:  |   Keywords:  attachements, encryption,
 |  multipart/encrypted
-+-

Comment (by Kevin McCarthy ):

 In [changeset:"ee1fd4a71a8a74195b6039433920a59cda5329af"
 7122:ee1fd4a71a8a]:
 {{{
 #!CommitTicketReference repository=""
 revision="ee1fd4a71a8a74195b6039433920a59cda5329af"
 Add helpers to add and remove actx entries. (see #3728)

 Use the helper in compose update_idx(), to consolidate the resize
 logic and simplify the code.

 Separate out the actx "free" routine from a routine to empty out the
 idx.  The index regeneration routines should flush and rebuild the
 index without having to renerate the actx structure.
 }}}

--
Ticket URL: 
Mutt 
The Mutt mail user agent



Re: [Mutt] #3728: unable to view encrypted multipart attachments

2017-08-11 Thread Mutt
#3728: unable to view encrypted multipart attachments
-+-
  Reporter:  rejozenger  |  Owner:  mutt-dev
  Type:  defect  | Status:  new
  Priority:  minor   |  Milestone:
 Component:  crypto  |Version:  1.5.23
Resolution:  |   Keywords:  attachements, encryption,
 |  multipart/encrypted
-+-

Comment (by Kevin McCarthy ):

 In [changeset:"23ce88ed8961cba5895445b896cc51d5edbdc814"
 7123:23ce88ed8961]:
 {{{
 #!CommitTicketReference repository=""
 revision="23ce88ed8961cba5895445b896cc51d5edbdc814"
 Change recvattach to allow nested encryption. (see #3728)

 * Add a FP and BODY array to the actx.  These are used to allow proper
   cleanup.

 * Add HEADER and root_fp entries, to allow for index regeneration.

 * Separate out the compose and recvattach index generation functions.

 * Change the recvattach index generator to decrypt as encrypted parts
   are found.
 }}}

--
Ticket URL: 
Mutt 
The Mutt mail user agent