GHashTable *attrs; /* Can be empty */
};
+enum rspamd_contetn_disposition_type {
+ RSPAMD_CT_UNKNOWN = 0,
+ RSPAMD_CT_INLINE = 1,
+ RSPAMD_CT_ATTACHMENT = 2,
+};
+
struct rspamd_content_disposition {
gchar *lc_data;
- enum {
- RSPAMD_CT_UNKNOWN = 0,
- RSPAMD_CT_INLINE = 1,
- RSPAMD_CT_ATTACHMENT = 2,
- } type;
+ enum rspamd_contetn_disposition_type type;
rspamd_ftok_t filename;
GHashTable *attrs; /* Can be empty */
};
guint i;
GPtrArray *hdrs;
struct rspamd_content_disposition *cd = NULL;
+ rspamd_ftok_t srch, *found;
hdrs = rspamd_message_get_header_from_hash (part->raw_headers,
task->task_pool,
if (hdrs == NULL) {
cd = rspamd_mempool_alloc0 (task->task_pool, sizeof (*cd));
cd->type = RSPAMD_CT_INLINE;
+
+ /* We can also have content dispositon definitions in Content-Type */
+ if (part->ct) {
+ RSPAMD_FTOK_ASSIGN (&srch, "name");
+ found = g_hash_table_lookup (part->ct->attrs, &srch);
+
+ if (!found) {
+ RSPAMD_FTOK_ASSIGN (&srch, "filename");
+ found = g_hash_table_lookup (part->ct->attrs, &srch);
+ }
+
+ if (found) {
+ cd->type = RSPAMD_CT_ATTACHMENT;
+ memcpy (&cd->filename, found, sizeof (cd->filename));
+ }
+ }
+
}
else {
for (i = 0; i < hdrs->len; i ++) {