mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-17 23:14:52 +01:00
67666538b3
Implement a functional identification and repair process for "Mixed Up" MIME messages as described in https://tools.ietf.org/html/draft-dkg-openpgp-pgpmime-message-mangling-00#section-4.1 The detection test is not entirely complete, in that it does not verify the contents of the latter two message subparts, but this is probably safe to skip, because those two parts are unlikely to be readable anyway, and the only part we are effectively omitting (the first subpart) is guaranteed to be empty anyway, so its removal can be reversed if you want to do so. I've left FIXMEs in the code so that anyone excited about adding these additional checks can see where to put them in. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
44 lines
1.5 KiB
C
44 lines
1.5 KiB
C
#ifndef _REPAIR_H
|
|
#define _REPAIR_H
|
|
|
|
#include "gmime-extra.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* This is a collection of message structure and message format repair
|
|
* techniques that are designed to improve the user experience of
|
|
* notmuch */
|
|
|
|
/* If payload is a cryptographic payload within an encrypted message, and
|
|
* it has a "legacy display" part, then we can skip over it and jump
|
|
* to the actual content, because notmuch already handles protected
|
|
* headers appropriately.
|
|
*
|
|
* This function either returns payload directly (if it does not have
|
|
* a "legacy display" part), or it returns a pointer to its
|
|
* content-bearing subpart, with the "legacy display" part and the
|
|
* surrounding multipart/mixed object bypassed.
|
|
*
|
|
* No new objects are created by calling this function, and the
|
|
* returned object will only be released when the original part is
|
|
* disposed of.
|
|
*/
|
|
|
|
GMimeObject *
|
|
_notmuch_repair_crypto_payload_skip_legacy_display (GMimeObject *payload);
|
|
|
|
/* Detecting and repairing "Mixed-Up MIME mangling". see
|
|
* https://tools.ietf.org/html/draft-dkg-openpgp-pgpmime-message-mangling-00#section-4.1
|
|
* If this returns NULL, the message was probably not "Mixed up". If
|
|
* it returns non-NULL, then there is a newly-allocated MIME part that
|
|
* represents the repaired version. The caller is responsible for
|
|
* ensuring that any returned object is freed with g_object_unref. */
|
|
GMimeObject *
|
|
_notmuch_repair_mixed_up_mangled (GMimeObject *part);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|