diff options
author | Kevin McCarthy <kevin@8t8.us> | 2017-08-10 18:18:21 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2017-08-10 18:18:21 -0700 |
commit | 2fd6f99bea1337e1b490a9056033fe0151f22ddc (patch) | |
tree | 58ed4ac34b12270b6c495d8f20ef805b9d376481 /attach.c | |
parent | 7a002ec117886669ba9e1f19bed506847b730c9d (diff) |
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.
Diffstat (limited to 'attach.c')
-rw-r--r-- | attach.c | 41 |
1 files changed, 40 insertions, 1 deletions
@@ -1059,6 +1059,36 @@ void mutt_actx_add_attach (ATTACH_CONTEXT *actx, ATTACHPTR *attach, MUTTMENU *me actx->idx[actx->idxlen++] = attach; } +void mutt_actx_add_fp (ATTACH_CONTEXT *actx, FILE *new_fp) +{ + int i; + + if (actx->fp_len == actx->fp_max) + { + actx->fp_max += 5; + safe_realloc (&actx->fp_idx, sizeof (FILE *) * actx->fp_max); + for (i = actx->fp_len; i < actx->fp_max; i++) + actx->fp_idx[i] = NULL; + } + + actx->fp_idx[actx->fp_len++] = new_fp; +} + +void mutt_actx_add_body (ATTACH_CONTEXT *actx, BODY *new_body) +{ + int i; + + if (actx->body_len == actx->body_max) + { + actx->body_max += 5; + safe_realloc (&actx->body_idx, sizeof (BODY *) * actx->body_max); + for (i = actx->body_len; i < actx->body_max; i++) + actx->body_idx[i] = NULL; + } + + actx->body_idx[actx->body_len++] = new_body; +} + void mutt_actx_free_entries (ATTACH_CONTEXT *actx) { int i; @@ -1070,8 +1100,15 @@ void mutt_actx_free_entries (ATTACH_CONTEXT *actx) FREE (&actx->idx[i]->tree); FREE (&actx->idx[i]); } - actx->idxlen = 0; + + for (i = 0; i < actx->fp_len; i++) + safe_fclose (&actx->fp_idx[i]); + actx->fp_len = 0; + + for (i = 0; i < actx->body_len; i++) + mutt_free_body (&actx->body_idx[i]); + actx->body_len = 0; } void mutt_free_attach_context (ATTACH_CONTEXT **pactx) @@ -1084,5 +1121,7 @@ void mutt_free_attach_context (ATTACH_CONTEXT **pactx) actx = *pactx; mutt_actx_free_entries (actx); FREE (&actx->idx); + FREE (&actx->fp_idx); + FREE (&actx->body_idx); FREE (pactx); /* __FREE_CHECKED__ */ } |