diff --git a/unit_tests/1.eml b/unit_tests/1.eml index 98763f6b..43838a6a 100644 --- a/unit_tests/1.eml +++ b/unit_tests/1.eml @@ -3098,10 +3098,27 @@ tCKgKAYZGOMAqGJ1NjuiziYCE1UzaYxjfm52XZASf3ZNntqLqJw5BTfTMR2Tx/8/AGsLWCSb7+jo AAAAAElFTkSuQmCC --b2_ajahhdddhjdhddh -Content-Type: image/jpeg; name="black.jpg" +Content-Type: image/jpeg; + name="=?utf-8?B?4Lib4Lix4LiI4LiI4Lix4Lii4Liq4Liz4LiE4Lix4LiNIDUg4Lib4Lij4Liw?= + =?utf-8?B?4LiB4Liy4LijIOC4geC4seC4muC4geC4suC4o+C5gOC4hOC4peC4t+C5iA==?= + =?utf-8?B?4Lit4LiZ4LmE4Lir4Lin4LmD4LiZ4LiV4Lil4Liy4LiU4Lit4Lix4LiV4Lij?= + =?utf-8?B?4Liy4LmB4Lil4LiB4LmA4Lib4Lil4Li14LmI4Lii4LiZLuC5gOC4nuC4tA==?= + =?utf-8?B?4LmI4Lih4LmA4LiV4Li04LihLmRvY3g=?=" +Content-Description: =?utf-8?B?4Lib4Lix4LiI4LiI4Lix4Lii4Liq4Liz4LiE4Lix4LiNIDUg4Lib4Lij4Liw?= + =?utf-8?B?4LiB4Liy4LijIOC4geC4seC4muC4geC4suC4o+C5gOC4hOC4peC4t+C5iA==?= + =?utf-8?B?4Lit4LiZ4LmE4Lir4Lin4LmD4LiZ4LiV4Lil4Liy4LiU4Lit4Lix4LiV4Lij?= + =?utf-8?B?4Liy4LmB4Lil4LiB4LmA4Lib4Lil4Li14LmI4Lii4LiZLuC5gOC4nuC4tA==?= + =?utf-8?B?4LmI4Lih4LmA4LiV4Li04LihLmRvY3g=?= +Content-Disposition: attachment; + filename="=?utf-8?B?4Lib4Lix4LiI4LiI4Lix4Lii4Liq4Liz4LiE4Lix4LiNIDUg4Lib4Lij4Liw?= + =?utf-8?B?4LiB4Liy4LijIOC4geC4seC4muC4geC4suC4o+C5gOC4hOC4peC4t+C5iA==?= + =?utf-8?B?4Lit4LiZ4LmE4Lir4Lin4LmD4LiZ4LiV4Lil4Liy4LiU4Lit4Lix4LiV4Lij?= + =?utf-8?B?4Liy4LmB4Lil4LiB4LmA4Lib4Lil4Li14LmI4Lii4LiZLuC5gOC4nuC4tA==?= + =?utf-8?B?4LmI4Lih4LmA4LiV4Li04LihLmRvY3g=?="; size=12345; + creation-date="Sun, 14 Jan 2018 06:24:32 GMT"; + modification-date="Sun, 14 Jan 2018 06:24:32 GMT" Content-Transfer-Encoding: base64 Content-ID: -Content-Disposition: inline; filename="black.jpg" /9j/4SURRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAA agEoAAMAAAABAAIAAAExAAIAAAAcAAAAcgEyAAIAAAAUAAAAjodpAAQAAAABAAAApAAAANAACvyA diff --git a/unit_tests/Makefile.in b/unit_tests/Makefile.in index 0bb24d3e..9dad2c25 100644 --- a/unit_tests/Makefile.in +++ b/unit_tests/Makefile.in @@ -24,7 +24,7 @@ RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)` INSTALL = @INSTALL@ -all: check_parser_utils check_rules check_digest check_mydomains check_parser check_decoder check_hash check_misc smtp +all: check_parser_utils check_rules check_digest check_mydomains check_parser check_decoder check_hash check_misc check_attachments smtp check_parser_utils: check_parser_utils.c ../src/libpiler.a $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) @@ -50,6 +50,9 @@ check_hash: check_hash.c ../src/libpiler.a check_misc: check_misc.c ../src/libpiler.a $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) +check_attachments: check_attachments.c ../src/libpiler.a + $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) + smtp: smtp.c ../src/libpiler.a $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) @@ -57,7 +60,7 @@ install: @echo clean: - rm -f check_parser_utils check_rules check_digest check_mydomains check_parser check_decoder check_hash check_misc smtp + rm -f check_parser_utils check_rules check_digest check_mydomains check_parser check_decoder check_hash check_misc check_attachments smtp distclean: clean rm -f Makefile diff --git a/unit_tests/check_attachments.c b/unit_tests/check_attachments.c new file mode 100644 index 00000000..961f54ac --- /dev/null +++ b/unit_tests/check_attachments.c @@ -0,0 +1,82 @@ +/* + * check_attachments.c, SJ + */ + +#include "test.h" + + +static void test_attachments(struct config *cfg){ + unsigned int i; + int j; + char n_attachments[10]; + struct stat st; + struct session_data sdata; + struct parser_state state; + struct data data; + + struct attachments { + char s[SMALLBUFSIZE]; + char *attachments[3]; + int n_attachments; + }; + + struct attachments tests[] = { + {"1.eml", {"jatekbolt_logo.png", "ปัจจัยสำคัญ 5 ประการ กับการเคลื่อนไหวในตลาดอัตราแลกเปลี่ยน.เพิ่มเติม.docx", NULL}, 2}, + {"30-subject.eml", {NULL, NULL, NULL}, 0}, + }; + + TEST_HEADER(); + + snprintf(data.licence.hostname, TINYBUFSIZE-1, "yourdomain.com"); + + for(i=0; i