Added PEP_enc_format : PEP_enc_PGP_MIME_Outlook1, to detect PGP_MIME messages that have been re-encoded by Outlook with attachments in different order
authorEdouard Tisserant <edouard@pep-project.org>
Thu, 26 Jan 2017 16:44:37 +0100
changeset 155772aa4570d2c9
parent 1556 cf1858982be2
child 1558 02b4593103fd
Added PEP_enc_format : PEP_enc_PGP_MIME_Outlook1, to detect PGP_MIME messages that have been re-encoded by Outlook with attachments in different order
src/message.h
src/message_api.c
src/mime.c
     1.1 --- a/src/message.h	Tue Jan 24 15:47:17 2017 +0100
     1.2 +++ b/src/message.h	Thu Jan 26 16:44:37 2017 +0100
     1.3 @@ -33,6 +33,8 @@
     1.4      PEP_enc_pieces,                         // inline PGP + PGP extensions
     1.5      PEP_enc_S_MIME,                         // RFC5751
     1.6      PEP_enc_PGP_MIME,                       // RFC3156
     1.7 +    PEP_enc_PGP_MIME_Outlook1,              // Message B0rken by Outlook type 1
     1.8 +    //PEP_enc_PGP_MIME_Outlook2,              // Message B0rken by Outlook type 2
     1.9      PEP_enc_PEP                             // pEp encryption format
    1.10  } PEP_enc_format;
    1.11  
     2.1 --- a/src/message_api.c	Tue Jan 24 15:47:17 2017 +0100
     2.2 +++ b/src/message_api.c	Thu Jan 26 16:44:37 2017 +0100
     2.3 @@ -1030,6 +1030,13 @@
     2.4          msg->enc_format = PEP_enc_PGP_MIME;
     2.5          return PEP_crypt_OpenPGP;
     2.6      }
     2.7 +    else if (msg->attachments && msg->attachments->next &&
     2.8 +            is_mime_type(msg->attachments->next, "application/pgp-encrypted") &&
     2.9 +            is_PGP_message_text(msg->attachments->value)
    2.10 +        ) {
    2.11 +        msg->enc_format = PEP_enc_PGP_MIME_Outlook1;
    2.12 +        return PEP_crypt_OpenPGP;
    2.13 +    }
    2.14      else {
    2.15          msg->enc_format = PEP_enc_none;
    2.16          return PEP_crypt_none;
    2.17 @@ -1625,6 +1632,11 @@
    2.18              csize = src->attachments->next->size;
    2.19              break;
    2.20  
    2.21 +        case PEP_enc_PGP_MIME_Outlook1:
    2.22 +            ctext = src->attachments->value;
    2.23 +            csize = src->attachments->size;
    2.24 +            break;
    2.25 +
    2.26          case PEP_enc_pieces:
    2.27              ctext = src->longmsg;
    2.28              csize = strlen(ctext);
    2.29 @@ -1655,6 +1667,7 @@
    2.30      if (ptext) {
    2.31          switch (src->enc_format) {
    2.32              case PEP_enc_PGP_MIME:
    2.33 +            case PEP_enc_PGP_MIME_Outlook1:
    2.34                  status = mime_decode_message(ptext, psize, &msg);
    2.35                  if (status != PEP_STATUS_OK)
    2.36                      goto pep_error;                
    2.37 @@ -1809,6 +1822,7 @@
    2.38          switch (src->enc_format) {
    2.39              case PEP_enc_PGP_MIME:
    2.40              case PEP_enc_pieces:
    2.41 +            case PEP_enc_PGP_MIME_Outlook1:
    2.42                  status = copy_fields(msg, src);
    2.43                  if (status != PEP_STATUS_OK)
    2.44                      goto pep_error;
    2.45 @@ -2377,7 +2391,7 @@
    2.46            words))
    2.47          return PEP_ILLEGAL_VALUE;
    2.48      
    2.49 -    pEp_identity* partner;
    2.50 +    pEp_identity* partner = NULL;
    2.51       
    2.52      PEP_STATUS status = PEP_STATUS_OK;
    2.53      
     3.1 --- a/src/mime.c	Tue Jan 24 15:47:17 2017 +0100
     3.2 +++ b/src/mime.c	Thu Jan 26 16:44:37 2017 +0100
     3.3 @@ -764,6 +764,9 @@
     3.4  
     3.5          case PEP_enc_PEP:
     3.6              NOT_IMPLEMENTED
     3.7 +
     3.8 +        default:
     3.9 +            NOT_IMPLEMENTED
    3.10      }
    3.11  
    3.12      if (status != PEP_STATUS_OK)