1
0
Fork 0

Fixed parsing of plain RFC 2047 strings

This commit is contained in:
bagyenda 2011-05-04 11:19:45 +00:00
parent dc3ad6068d
commit 265c827fe1
2 changed files with 23 additions and 4 deletions

View File

@ -1,3 +1,5 @@
2011-05-04 P. A. Bagyenda <bagyenda@dsmagic.com>
* Fixed parsing of encoded-string-value that contains RFC 2047 text (e.g. To, Cc, Bcc fields)
2011-03-28 P. A. Bagyenda <bagyenda@dsmagic.com>
* Updated doc to include mmsbox admin interface info
2011-03-24 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -278,9 +278,26 @@ static Octstr *decode_encoded_string_value(int ret, ParseContext *context, unsig
} else if (ret2 != WSP_FIELD_VALUE_NUL_STRING) {
mms_warning(0, "mms_msg", NULL, "Faulty header value for %s! [ret=%d,ret2=%d]\n", hname,ret,ret2);
res = octstr_imm("");
} else
res = parse_get_nul_string(context);
} else { /* String may be RFC 2047 encoded */
int mib = UTF8_MIB_VAL;
Octstr *xs = parse_get_nul_string(context);
res = parse_rfc2047_text(xs, &mib);
octstr_destroy(xs);
if (mib != UTF8_MIB_VAL && mib != US_ASCII_MIB_VAL) { /* Convert to UTF-8 */
const char *charset = mibenum_to_charset(mib);
Octstr *xcharset = octstr_imm(charset);
Octstr *out = NULL;
if (charset_to_utf8(res, &out, xcharset) > 0 && out) {
octstr_destroy(res);
res = out;
} else
octstr_destroy(out);
out = NULL;
}
}
return res;
}
@ -701,7 +718,7 @@ static void mms_pack_well_known_field(Octstr *os, int field_type, Octstr *value)
int charset;
Octstr *xvalue = parse_rfc2047_text(value, &charset);
if (charset == US_ASCII_MIB_VAL)
if (charset == US_ASCII_MIB_VAL) /* Leave as text */
wsp_pack_text(os, xvalue);
else { /* Need to use the other encoding */
wsp_pack_integer_value(encoded, charset);