[IMAPx] Fails to parse some BODYSTRUCTURE responses
I received an S/MIME signed message to a Yahoo! account and the BODYSTRUCTURE response the Yahoo! server generates breaks IMAPx in away that it stops folder refresh with error "unknown body response". The Yahoo! server BODYSTRUCURE looks like:
( ( ("text" "plain" ("charset" "utf-8") NIL NIL "8bit" 3971 103 NIL NIL NIL NIL) ("text" "plain" ("charset" "utf-8") NIL NIL "8bit" 181 8 NIL NIL NIL NIL) ("text" "x-vcard" ("charset" "utf-8") NIL NIL "8bit" 338 12 NIL NIL NIL NIL) "mixed" ("boundary" "===============5254826394857694879==") NIL ) ("application" "x-pkcs7-signature" ("name" "smime.p7s") NIL NIL "base64" 3582 NIL ("attachment" ("filename" "smime.p7s")) NIL NIL) "signed" ("boundary" "----227CBF9D7F33CDD9ED8287D080A16FB9" "protocol" "application/x-pkcs7-signature" "micalg" "sha-256") NIL )
while a working response from a different server (I think Dovecot, but I'm not sure) of the same message looks like:
( ( ("text" "plain" ("charset" "utf-8") NIL NIL "8bit" 3971 103 NIL NIL NIL NIL) ("text" "plain" ("charset" "utf-8") NIL NIL "8bit" 181 8 NIL NIL NIL NIL) ("text" "x-vcard" ("charset" "utf-8") NIL NIL "8bit" 338 12 NIL NIL NIL NIL) "mixed" ("boundary" "===============5254826394857694879==") NIL NIL NIL ) ("application" "x-pkcs7-signature" ("name" "smime.p7s") NIL NIL "base64" 3582 NIL ("attachment" ("filename" "smime.p7s")) NIL NIL) "signed" ("protocol" "application/x-pkcs7-signature" "micalg" "sha-256" "boundary" "----227CBF9D7F33CDD9ED8287D080A16FB9") NIL NIL NIL )
where the difference is how many NIL tokens the lines with "mixed" and "signed" parts have at the end.