for _,position in ipairs(match.positions) do
local matched = false
for _,pos in ipairs(matched_positions) do
+ lua_util.debugm(N, log_obj, 'found match %s at offset %s(from %s)',
+ pattern.ext, pos, offset)
if not match_position(pos + offset, position) then
matched = true
break
case RSPAMD_CTE_B64:
ret = "base64";
break;
+ case RSPAMD_CTE_UUE:
+ ret = "X-uuencode";
+ break;
default:
break;
}
else if (strcmp (str, "base64") == 0) {
ret = RSPAMD_CTE_B64;
}
+ else if (strcmp (str, "X-uuencode") == 0) {
+ ret = RSPAMD_CTE_UUE;
+ }
+ else if (strcmp (str, "uuencode") == 0) {
+ ret = RSPAMD_CTE_UUE;
+ }
+ else if (strcmp (str, "X-uue") == 0) {
+ ret = RSPAMD_CTE_UUE;
+ }
return ret;
}
case 0x171029DE1B0423A9ULL: /* base-64 */
ret = RSPAMD_CTE_B64;
break;
+ case 0x420b54dc00d13cecULL: /* uuencode */
+ case 0x8df6700b8f6c4cf9ULL: /* x-uuencode */
+ case 0x41f725ec544356d3ULL: /* x-uue */
+ ret = RSPAMD_CTE_UUE;
+ break;
}
return ret;
p ++;
}
+ if (end - p > sizeof ("begin-base64 ")) {
+ const guchar *uue_start;
+
+ if (memcmp (p, "begin ", sizeof ("begin ") - 1) == 0) {
+ uue_start = p + sizeof ("begin ") - 1;
+
+ while (uue_start < end && g_ascii_isspace (*uue_start)) {
+ uue_start ++;
+ }
+
+ if (uue_start < end && g_ascii_isdigit (*uue_start)) {
+ return RSPAMD_CTE_UUE;
+ }
+ }
+ else if (memcmp (p, "begin-base64 ", sizeof ("begin-base64 ") - 1) == 0) {
+ uue_start = p + sizeof ("begin ") - 1;
+
+ while (uue_start < end && g_ascii_isspace (*uue_start)) {
+ uue_start ++;
+ }
+
+ if (uue_start < end && g_ascii_isdigit (*uue_start)) {
+ return RSPAMD_CTE_UUE;
+ }
+ }
+ }
+
if (end > p + 2) {
if (*(end - 1) == '=') {
neqsign ++;
rspamd_mempool_add_destructor (task->task_pool,
(rspamd_mempool_destruct_t)rspamd_fstring_free, parsed);
break;
+ case RSPAMD_CTE_UUE:
+ parsed = rspamd_fstring_sized_new (part->raw_data.len / 4 * 3 + 12);
+ r = rspamd_decode_uue_buf (part->raw_data.begin, part->raw_data.len,
+ parsed->str, parsed->allocated);
+ rspamd_mempool_add_destructor (task->task_pool,
+ (rspamd_mempool_destruct_t)rspamd_fstring_free, parsed);
+ if (r != -1) {
+ parsed->len = r;
+ part->parsed_data.begin = parsed->str;
+ part->parsed_data.len = parsed->len;
+ }
+ else {
+ msg_err_task ("invalid quoted-printable encoded part, assume 8bit");
+ part->ct->flags |= RSPAMD_CONTENT_TYPE_BROKEN;
+ part->cte = RSPAMD_CTE_8BIT;
+ memcpy (parsed->str, part->raw_data.begin, part->raw_data.len);
+ parsed->len = part->raw_data.len;
+ part->parsed_data.begin = parsed->str;
+ part->parsed_data.len = parsed->len;
+ }
+ break;
default:
g_assert_not_reached ();
}