...
authorvb
Sun, 15 Mar 2015 22:09:59 +0100
changeset 118217e8ebe524a
parent 117 d2ff99ccdf30
child 119 cf32295fd797
...
src/mime.c
     1.1 --- a/src/mime.c	Sun Mar 15 21:07:12 2015 +0100
     1.2 +++ b/src/mime.c	Sun Mar 15 22:09:59 2015 +0100
     1.3 @@ -1185,6 +1185,68 @@
     1.4      return status;
     1.5  }
     1.6  
     1.7 +static PEP_STATUS interpret_MIME(
     1.8 +        struct mailmime *mime,
     1.9 +        message *msg
    1.10 +    )
    1.11 +{
    1.12 +    PEP_STATUS status = PEP_STATUS_OK;
    1.13 +
    1.14 +    assert(mime);
    1.15 +    assert(msg);
    1.16 +
    1.17 +    struct mailmime_content *content = mime->mm_content_type;
    1.18 +    if (content) {
    1.19 +        if (msg->longmsg == NULL && content->ct_type &&
    1.20 +                content->ct_type->tp_type == MAILMIME_TYPE_COMPOSITE_TYPE
    1.21 +                && content->ct_type->tp_data.tp_composite_type
    1.22 +                && content->ct_type->tp_data.tp_composite_type->ct_type ==
    1.23 +                        MAILMIME_COMPOSITE_TYPE_MULTIPART
    1.24 +                && content->ct_subtype
    1.25 +                && strcmp(content->ct_subtype, "alternative") == 0) {
    1.26 +
    1.27 +            clist *partlist = mime->mm_data.mm_multipart.mm_mp_list;
    1.28 +            if (partlist == NULL)
    1.29 +                return PEP_ILLEGAL_VALUE;
    1.30 +
    1.31 +            clistiter *cur;
    1.32 +            for (cur = clist_begin(partlist); cur; cur = clist_next(cur)) {
    1.33 +                struct mailmime *part= clist_content(cur);
    1.34 +                if (part == NULL)
    1.35 +                    return PEP_ILLEGAL_VALUE;
    1.36 +
    1.37 +
    1.38 +            }
    1.39 +        }
    1.40 +        if (content->ct_type &&
    1.41 +                content->ct_type->tp_type == MAILMIME_TYPE_COMPOSITE_TYPE
    1.42 +                && content->ct_type->tp_data.tp_composite_type
    1.43 +                && content->ct_type->tp_data.tp_composite_type->ct_type ==
    1.44 +                        MAILMIME_COMPOSITE_TYPE_MULTIPART) {
    1.45 +
    1.46 +            clist *partlist = mime->mm_data.mm_multipart.mm_mp_list;
    1.47 +            if (partlist == NULL)
    1.48 +                return PEP_ILLEGAL_VALUE;
    1.49 +
    1.50 +            clistiter *cur;
    1.51 +            for (cur = clist_begin(partlist); cur; cur = clist_next(cur)) {
    1.52 +                struct mailmime *part= clist_content(cur);
    1.53 +                if (part == NULL)
    1.54 +                    return PEP_ILLEGAL_VALUE;
    1.55 +
    1.56 +                status = interpret_MIME(part, msg);
    1.57 +                if (status != PEP_STATUS_OK)
    1.58 +                    return status;
    1.59 +            }
    1.60 +        }
    1.61 +        else {
    1.62 +
    1.63 +        }
    1.64 +    }
    1.65 +
    1.66 +    return PEP_STATUS_OK;
    1.67 +}
    1.68 +
    1.69  static PEP_STATUS interpret_PGP_MIME(struct mailmime *mime, message *msg)
    1.70  {
    1.71      assert(mime);
    1.72 @@ -1310,6 +1372,10 @@
    1.73                  goto pep_error;
    1.74          }
    1.75          else {
    1.76 +            status = interpret_MIME(mime->mm_data.mm_message.mm_msg_mime,
    1.77 +                    _msg);
    1.78 +            if (status != PEP_STATUS_OK)
    1.79 +                goto pep_error;
    1.80          }
    1.81      }
    1.82