|
From: Florian L. <f.l...@mo...> - 2017-03-10 18:04:39
|
Le 10/03/2017 à 18:53, Oswald Buddenhagen a écrit :
> On Fri, Mar 10, 2017 at 06:41:11PM +0100, Florian Lombard wrote:
>> I'm planning to do it the right way and contribute a patch, but I'm no
>> C coder and the result may be ugly
>>
> coding skills or not, i have no clue what the correct semantics would
> be.
> i guess pre-examining the messages and marking them as skipped is an
> option (taking inspiration from the wip/placeholders branch would be
> probably advisable).
> alternatively, the messages could be re-coded to something valid, say
> quoted-printable (which introduces line breaks as needed). that would
> still invalidate digital signatures, but better than nothing.
Actually, I've done that
static void
imap_fetch_msg_p2( imap_store_t *ctx, struct imap_cmd *gcmd, int response )
{
struct imap_cmd_fetch_msg *cmd = (struct imap_cmd_fetch_msg *)gcmd;
if (response == RESP_OK && !cmd->msg_data->data) {
/* The FETCH succeeded, but there is no message with
this UID. */
response = RESP_NO;
}
/* TEST MaxLineLenght */
if (response == RESP_OK) {
char * curLine = cmd->msg_data->data;
while(curLine) {
char * nextLine = strchr(curLine, '\n');
unsigned curLineLen = nextLine ? (nextLine-curLine) :
strlen(curLine);
if (curLineLen > 10000) { /* Skip messages with >
10000 bytes lines in them */
response = RESP_NO;
break;
}
curLine = nextLine ? (nextLine+1) : NULL;
}
}
/* END TEST MaxLineLenght */
imap_done_simple_msg( ctx, gcmd, response );
}
First I will mark messages with tuid -1 , same as too big messages
Then I will make it configurable
And hopefully I'll manage to cut too long lines with a regex like
s,(.{9900}),$1\r\n,g (configurable option, too) (this part is going to
be "funny" for me)
Or do you think it's a better approach to use a new tuid, like -3 ?
As for digital signatures, as the messages are already not respecting
the RFC (1000 chars max per line) ... I guess it's not a big deal
|