Skip to content

Commit 00b7d60

Browse files
committed
pffimport: hook up attachments to their message objects
1 parent 3b4024a commit 00b7d60

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tools/pffimport.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,10 @@ static int do_attach(unsigned int depth, ATTACHMENT_CONTENT *atc, libpff_item_t
294294
return ret;
295295
} else if (atype == LIBPFF_ATTACHMENT_TYPE_REFERENCE) {
296296
tlog("[attachment type=%c]\n", atype);
297+
return -EOPNOTSUPP;
297298
} else {
298299
tlog("[attachment type=unknown]\n");
300+
return -EOPNOTSUPP;
299301
}
300302
return 0;
301303
}
@@ -771,6 +773,13 @@ static int do_item2(unsigned int depth, const parent_desc &parent,
771773
auto ret = do_attach(depth, atc.get(), item);
772774
if (ret < 0)
773775
return ret;
776+
if (parent.type == LIBPFF_ITEM_TYPE_EMAIL) {
777+
if (!attachment_list_append_internal(parent.message->children.pattachments, atc.get())) {
778+
fprintf(stderr, "attachment_list_append_internal: ENOMEM\n");
779+
return -ENOMEM;
780+
}
781+
atc.release();
782+
}
774783
}
775784

776785
/*

0 commit comments

Comments
 (0)