diff --git a/src/misc.h b/src/misc.h index ff58cdcb..08d9c728 100644 --- a/src/misc.h +++ b/src/misc.h @@ -27,6 +27,7 @@ char *split(char *str, int ch, char *buf, int buflen, int *result); char *split_str(char *row, char *what, char *s, int size); int trimBuffer(char *s); int extractEmail(char *rawmail, char *email); +int extract_verp_address(char *email); void make_random_string(char *buf, int buflen); void create_id(char *id, unsigned char server_id); int get_random_bytes(unsigned char *buf, int len, unsigned char server_id); diff --git a/unit_tests/Makefile.in b/unit_tests/Makefile.in index 6cb744ef..0bb24d3e 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 smtp +all: check_parser_utils check_rules check_digest check_mydomains check_parser check_decoder check_hash check_misc smtp check_parser_utils: check_parser_utils.c ../src/libpiler.a $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) @@ -41,6 +41,15 @@ check_mydomains: check_mydomains.c ../src/libpiler.a check_parser: check_parser.c ../src/libpiler.a $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) +check_decoder: check_decoder.c ../src/libpiler.a + $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) + +check_hash: check_hash.c ../src/libpiler.a + $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) + +check_misc: check_misc.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) @@ -48,7 +57,7 @@ install: @echo clean: - rm -f check_parser_utils check_rules check_digest check_mydomains check_parser smtp + rm -f check_parser_utils check_rules check_digest check_mydomains check_parser check_decoder check_hash check_misc smtp distclean: clean rm -f Makefile diff --git a/unit_tests/check_decoder.c b/unit_tests/check_decoder.c new file mode 100644 index 00000000..659a8700 --- /dev/null +++ b/unit_tests/check_decoder.c @@ -0,0 +1,130 @@ +/* + * check_decoder.c, SJ + */ + +#include "test.h" + +struct config cfg; + +static void test_decodeBase64(){ + unsigned int i; + struct test_data_s_s test_strings[] = { + { "Zm9vYmFy", "foobar" }, + { "Zm9vYmE=", "fooba" }, + { "Zm9vYg==", "foob" }, + { "Zm9v", "foo" }, + { "Zm8=", "fo" }, + { "Zg==", "f" }, + { "", "" }, + }; + + TEST_HEADER(); + + for(i=0; i2" }, + { "éljen május elseje!", "éljen május elseje!" }, + { "boni&klájd", "boni&klájd" }, + }; + + TEST_HEADER(); + + for(i=0; i\r\n", "aaa@aaa.fu" }, + { "MAIL FROM: \r\n", "aaa@aaa.fu" }, + { "RCPT TO: \r\n", "aaa@aaa.fu" }, + { "", "aaa@aaa.fu" }, + }; + + TEST_HEADER(); + + for(i=0; i