diff --git a/mbuni/mmlib/mms_msg.c b/mbuni/mmlib/mms_msg.c index 4516444..20025d3 100644 --- a/mbuni/mmlib/mms_msg.c +++ b/mbuni/mmlib/mms_msg.c @@ -1259,8 +1259,7 @@ static void convert_mime_msg(MIMEEntity *m) } if (h) http_destroy_headers(h); - if (params) - octstr_destroy(params); + octstr_destroy(params); if ((n = mime_entity_num_parts(m)) > 0) for (i = 0; i < n; i++) { MIMEEntity *x = mime_entity_get_part(m, i); @@ -1277,7 +1276,6 @@ static void unconvert_mime_msg(MIMEEntity *m) List *h = mime_entity_headers(m); n = get_content_type(h, &content_type, ¶ms); - if (n == 0 && content_type) { if (octstr_case_compare(content_type, octstr_imm("multipart/related")) == 0) @@ -1288,7 +1286,7 @@ static void unconvert_mime_msg(MIMEEntity *m) else if (octstr_case_compare(content_type, octstr_imm("multipart/mixed")) == 0) s = "application/vnd.wap.multipart.mixed"; - else if (octstr_case_search(content_type, octstr_imm("application/vnd.drm."), 0) == 0 && + else if (DRM_CONTENT_TYPE(content_type) && mime_entity_num_parts(m) > 0) { /* fixup drm that might have been screwed up. */ Octstr *x = mime_entity_body(m); while (mime_entity_num_parts(m) > 0) /* remove them all. this message must not be parsed as mime. */ diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index 240187f..d47b619 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -398,6 +398,8 @@ void unbase64_mimeparts(MIMEEntity *m) Octstr *ctype = http_header_value(headers, octstr_imm("Content-Type")); Octstr *te = http_header_value(headers, octstr_imm("Content-Transfer-Encoding")); + if (DRM_CONTENT_TYPE(ctype)) + goto done; /* leave it alone! */ if (ctype && te && octstr_case_compare(te,octstr_imm("base64")) == 0) { Octstr *s = mime_entity_body(m); @@ -408,8 +410,9 @@ void unbase64_mimeparts(MIMEEntity *m) http_header_remove_all(headers, "Content-Transfer-Encoding"); /* Remove it in all cases (?).*/ mime_replace_headers(m, headers); + done: /* XXX may be we should deal with other transfer encodings here as well... */ - + octstr_destroy(ctype); octstr_destroy(te); http_destroy_headers(headers); @@ -442,7 +445,8 @@ void base64_mimeparts(MIMEEntity *m, int all) if (ctype && (te == NULL || octstr_str_case_compare(te, "binary") == 0) && body && - (all || octstr_check_range(body, 0, octstr_len(body), _mms_gw_isprint) == 0)) { + (all || octstr_check_range(body, 0, octstr_len(body), _mms_gw_isprint) == 0) && + !DRM_CONTENT_TYPE(ctype)) { /* don't touch drm content object. */ octstr_binary_to_base64(body); http_header_remove_all(headers, "Content-Transfer-Encoding"); @@ -1170,7 +1174,7 @@ void strip_boundary_element(List *headers, char *s) octstr_destroy(ctype); ctype = NULL; /* no ctype found, so do not replace it! */ } else if (ctype && - octstr_case_search(ctype, octstr_imm("application/vnd.oma.drm"), 0) == 0) { + DRM_CONTENT_TYPE(ctype)) { octstr_destroy(ctype); ctype = NULL; /* leave drm alone! */ } diff --git a/mbuni/mmlib/mms_util.h b/mbuni/mmlib/mms_util.h index 31f812c..f4aa773 100644 --- a/mbuni/mmlib/mms_util.h +++ b/mbuni/mmlib/mms_util.h @@ -59,6 +59,8 @@ #define MMSC_VERSION MBUNI_VERSION #define MMS_NAME PACKAGE +#define DRM_CONTENT_TYPE(ctype) (octstr_case_search(ctype, octstr_imm("application/vnd.oma.drm"), 0) == 0) + /* Message location flags: Used to distinguish fetch-urls */ enum mms_loc_t {MMS_LOC_MMBOX = 1, MMS_LOC_MQUEUE=2};