Fix getting crypto text for enc type PEP_enc_PGP_MIME_Outlook1 sync
authorThomas
Thu, 19 Dec 2019 14:43:42 +0100
branchsync
changeset 4288929625a777b1
parent 4287 159969298292
child 4289 79af186cae4e
Fix getting crypto text for enc type PEP_enc_PGP_MIME_Outlook1
src/message_api.c
     1.1 --- a/src/message_api.c	Thu Dec 19 12:58:30 2019 +0100
     1.2 +++ b/src/message_api.c	Thu Dec 19 14:43:42 2019 +0100
     1.3 @@ -2741,20 +2741,33 @@
     1.4      PEP_STATUS status = PEP_STATUS_OK;
     1.5                      
     1.6      switch (src->enc_format) {
     1.7 -        case PEP_enc_PGP_MIME:
     1.8 -		case PEP_enc_PGP_MIME_Outlook1:
     1.9 -			*crypto_text = src->attachments->next->value;
    1.10 -			if (src->attachments->next->value[src->attachments->next->size - 1]) {
    1.11 -				// if the attachment is not ending with a trailing 0
    1.12 -				// then it is containing the crypto text directly
    1.13 -				*text_size = src->attachments->next->size;
    1.14 -			}
    1.15 -			else {
    1.16 -				// if the attachment is ending with trailing 0
    1.17 -				// then it is containting a string
    1.18 -				*text_size = strlen(src->attachments->next->value);
    1.19 -			}
    1.20 -            break;
    1.21 +    case PEP_enc_PGP_MIME:
    1.22 +        *crypto_text = src->attachments->next->value;
    1.23 +        if (src->attachments->next->value[src->attachments->next->size - 1]) {
    1.24 +            // if the attachment is not ending with a trailing 0
    1.25 +            // then it is containing the crypto text directly
    1.26 +            *text_size = src->attachments->next->size;
    1.27 +        }
    1.28 +        else {
    1.29 +            // if the attachment is ending with trailing 0
    1.30 +            // then it is containting a string
    1.31 +            *text_size = strlen(src->attachments->next->value);
    1.32 +        }
    1.33 +        break;
    1.34 +
    1.35 +    case PEP_enc_PGP_MIME_Outlook1:
    1.36 +        *crypto_text = src->attachments->value;
    1.37 +        if (src->attachments->value[src->attachments->size - 1]) {
    1.38 +            // if the attachment is not ending with a trailing 0
    1.39 +            // then it is containing the crypto text directly
    1.40 +            *text_size = src->attachments->size;
    1.41 +        }
    1.42 +        else {
    1.43 +            // if the attachment is ending with trailing 0
    1.44 +            // then it is containting a string
    1.45 +            *text_size = strlen(src->attachments->value);
    1.46 +        }
    1.47 +        break;
    1.48  
    1.49          case PEP_enc_inline:
    1.50              *crypto_text = src->longmsg;