# check if the qmail directory is maintained by the build, which means # we are running inside the testsuite and can mess with that directory IF (AUTOQMAIL MATCHES "^${CMAKE_BINARY_DIR}/") SET(AUTOQMAIL_FROM_TESTSUITE TRUE) file(WRITE "${CMAKE_BINARY_DIR}/var/qmail/control/outgoingip" "192.0.2.61") file(WRITE "${CMAKE_BINARY_DIR}/var/qmail/control/outgoingip6" "fd38:d30d:f257:35ac::42") file(WRITE "${CMAKE_BINARY_DIR}/var/qmail/control/databytes" "1024") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/tlsclientciphers_good/control/clientcert.pem" "${CMAKE_BINARY_DIR}/var/qmail/control/servercert.pem.2001:db8::123:587") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/tlsclientciphers_good/control/clientcert.pem" "${CMAKE_BINARY_DIR}/var/qmail/control/servercert.pem.192.0.2.19:587") file(STRINGS "${CMAKE_BINARY_DIR}/var/qmail/control/me" QSMTPD_GREETING_LINE LIMIT_COUNT 1 NO_HEX_CONVERSION) SET(QSMTPD_QUIT_LINE "221 2\\.0\\.0 ${QSMTPD_GREETING_LINE} service closing transmission channel\n") SET(QSMTPD_HELO_RESPONSE "250 ${QSMTPD_GREETING_LINE}\n") SET(QSMTPD_GREETING_LINE "220 ${QSMTPD_GREETING_LINE} Qsmtpd ${QSMTP_VERSION} ESMTP\n") ELSE () SET(AUTOQMAIL_FROM_TESTSUITE FALSE) SET(QSMTPD_QUIT_LINE "221 2\\.0\\.0 [^\n ]* service closing transmission channel\n") SET(QSMTPD_HELO_RESPONSE "250 [^\n ]*\n") SET(QSMTPD_GREETING_LINE "220 [^\n ]* Qsmtpd ${QSMTP_VERSION} ESMTP\n") ENDIF () ADD_SUBDIRECTORY(test_io) ADD_EXECUTABLE(testcase_spf spf_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/spf.c ${CMAKE_SOURCE_DIR}/qsmtpd/antispam.c ${CMAKE_SOURCE_DIR}/qremote/mime.c # for skipwhitespace() ) TARGET_LINK_LIBRARIES(testcase_spf qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES}) ADD_TEST(NAME "SPF_received" COMMAND testcase_spf "_received_") ADD_TEST(NAME "SPF_parser" COMMAND testcase_spf "_parse_") ADD_TEST(NAME "SPF_behavior" COMMAND testcase_spf "_behavior_") ADD_TEST(NAME "SPF_testsuite" COMMAND testcase_spf "_suite_") ADD_TEST(NAME "SPF_domain_redhat" COMMAND testcase_spf "redhat") ADD_TEST(NAME "SPF_domain_sf-mail" COMMAND testcase_spf "sf-mail") ADD_EXECUTABLE(testcase_control control_test.c) TARGET_LINK_LIBRARIES(testcase_control qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES}) ADD_TEST(NAME "Control" COMMAND testcase_control) ADD_EXECUTABLE(testcase_base64 base64_test.c) TARGET_LINK_LIBRARIES(testcase_base64 qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES}) ADD_TEST(NAME "Base64" COMMAND testcase_base64) ADD_EXECUTABLE(testcase_cdb cdb_test.c cdb_entries.h) TARGET_LINK_LIBRARIES(testcase_cdb qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "CDB" COMMAND testcase_cdb WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") ADD_EXECUTABLE(testcase_authsetup authsetup_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/auth.c) TARGET_LINK_LIBRARIES(testcase_authsetup qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES}) ADD_TEST(NAME "AUTH_Setup" COMMAND testcase_authsetup "${CMAKE_CURRENT_SOURCE_DIR}/authsetup") ADD_EXECUTABLE(testcase_auth_errors auth_errors_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/auth.c) TARGET_LINK_LIBRARIES(testcase_auth_errors qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES}) ADD_TEST(NAME "AUTH_errors" COMMAND testcase_auth_errors) ADD_EXECUTABLE(testcase_auth_be_cp auth_be_cp_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/child.c ) TARGET_LINK_LIBRARIES(testcase_auth_be_cp Qsmtpd_auth_checkpassword testcase_io_lib ${MEMCHECK_LIBRARIES}) ADD_TEST(NAME "AUTH_BE_chkpw" COMMAND testcase_auth_be_cp "${CMAKE_CURRENT_BINARY_DIR}/auth_dummy") ADD_EXECUTABLE(testcase_auth auth_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/auth.c ${CMAKE_SOURCE_DIR}/qsmtpd/child.c ) TARGET_LINK_LIBRARIES(testcase_auth qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES}) ADD_EXECUTABLE(auth_dummy auth_dummy.c) FOREACH (AUTHTEST short email long) FOREACH (AUTHFLAG correct wrong) FOREACH (AUTHMECH LOGIN PLAIN) ADD_TEST(NAME "AUTH-${AUTHMECH}-${AUTHTEST}-${AUTHFLAG}" COMMAND testcase_auth "${CMAKE_CURRENT_BINARY_DIR}/auth_dummy" ${AUTHTEST} ${AUTHMECH} ${AUTHFLAG}) ENDFOREACH (AUTHMECH) ENDFOREACH (AUTHFLAG) ENDFOREACH (AUTHTEST) ADD_EXECUTABLE(testcase_matchnet matchnet_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/antispam.c) TARGET_LINK_LIBRARIES(testcase_matchnet qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "MatchNet" COMMAND testcase_matchnet) ADD_EXECUTABLE(testcase_hostname hostname_test.c) TARGET_LINK_LIBRARIES(testcase_hostname qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Hostname" COMMAND testcase_hostname) ADD_EXECUTABLE(testcase_xtext xtext_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/addrsyntax.c ${CMAKE_SOURCE_DIR}/qsmtpd/xtext.c) TARGET_LINK_LIBRARIES(testcase_xtext qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Xtext" COMMAND testcase_xtext) ADD_EXECUTABLE(testcase_qrdata qrdata_test.c ${CMAKE_SOURCE_DIR}/qremote/qrdata.c ${CMAKE_SOURCE_DIR}/qremote/mime.c ) TARGET_LINK_LIBRARIES(testcase_qrdata qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qrdata_test_data") FOREACH(PATTERN simple crlfmixup dots "8bit+base64" longBodyLine longHeaderLineCR longHeaderLineLF longHeaderLine 8bitLF noLFatEnd 8bitHeader emptyLFheader emptyCRheader emptyLFheaderWith8bit emptyCRheaderWith8bit emptyCRLFheaderWith8bit NoEndBoundary NoEndBoundaryShortEnd EndInNotFinalBoundary EndsWithFinalBoundary MultipartNoBoundary longChunkBeforeRecode longChunkBeforeRecodeMultipart wrapHeadersWithLongParts whitespaceBeforeLinebreak 8bitAroundSoftbreak ContentTypeSyntaxError InvalidPreamble) ADD_TEST(NAME "QrData-${PATTERN}" COMMAND testcase_qrdata ${PATTERN}) SET_TESTS_PROPERTIES(QrData-${PATTERN} PROPERTIES ENVIRONMENT "QRDATA_INPUT_DIR=${CMAKE_CURRENT_SOURCE_DIR}") IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/qrdata_test_data/${PATTERN}.out") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/qrdata_test_data/${PATTERN}.out" "${CMAKE_CURRENT_BINARY_DIR}/qrdata_test_data/${PATTERN}.out" @ONLY) ENDIF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/qrdata_test_data/${PATTERN}.out") ENDFOREACH(PATTERN) SET_TESTS_PROPERTIES(QrData-8bitHeader PROPERTIES PASS_REGULAR_EXPRESSION "^(.*\n)?D5\\.6\\.3 message contains unencoded 8bit data in message header") SET_TESTS_PROPERTIES(QrData-ContentTypeSyntaxError PROPERTIES PASS_REGULAR_EXPRESSION "^(.*\n)?D5\\.6\\.3 syntax error in Content-Type message header") ADD_TEST(NAME QrData-DATA-4xx-error COMMAND testcase_qrdata data_reply_400 temporary error) SET_TESTS_PROPERTIES(QrData-DATA-4xx-error PROPERTIES PASS_REGULAR_EXPRESSION "^(.*\n)?Z4\\.3\\.0 .*temporary error") ADD_TEST(NAME QrData-DATA-5xx-error COMMAND testcase_qrdata data_reply_500 permanent error) SET_TESTS_PROPERTIES(QrData-DATA-5xx-error PROPERTIES PASS_REGULAR_EXPRESSION "^(.*\n)?D5\\.3\\.0 .*permanent error") ADD_EXECUTABLE(testcase_qrbdat qrbdat_test.c ${CMAKE_SOURCE_DIR}/qremote/qrbdat.c ) TARGET_LINK_LIBRARIES(testcase_qrbdat qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "QrBDAT" COMMAND testcase_qrbdat) ADD_EXECUTABLE(testcase_fmt fmt_test.c) TARGET_LINK_LIBRARIES(testcase_fmt qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Fmt" COMMAND testcase_fmt) ADD_EXECUTABLE(testcase_addrparse addrparse_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/addrparse.c) TARGET_LINK_LIBRARIES(testcase_addrparse qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "AddrParse" COMMAND testcase_addrparse) ADD_EXECUTABLE(testcase_addrsyntax addrsyntax_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/addrsyntax.c) TARGET_LINK_LIBRARIES(testcase_addrsyntax qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "AddrSyntax" COMMAND testcase_addrsyntax) ADD_EXECUTABLE(testcase_mmap mmap_test.c) TARGET_LINK_LIBRARIES(testcase_mmap qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Mmap" COMMAND testcase_mmap) ADD_EXECUTABLE(testcase_dns dns_test.c) TARGET_LINK_LIBRARIES(testcase_dns qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "DNS" COMMAND testcase_dns) ADD_EXECUTABLE(testcase_qdns qdns_test.c ../lib/qdns.c) TARGET_LINK_LIBRARIES(testcase_qdns qsmtp_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "QDNS" COMMAND testcase_qdns) INCLUDE_DIRECTORIES(${OWFAT_INCLUDE_DIRS}) ADD_EXECUTABLE(testcase_qdns_dane qdns_dane_test.c ${CMAKE_SOURCE_DIR}/lib/qdns_dane.c ) TARGET_LINK_LIBRARIES(testcase_qdns_dane qsmtp_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "QDNS_DANE" COMMAND testcase_qdns_dane) ADD_EXECUTABLE(testcase_mime mime_test.c ${CMAKE_SOURCE_DIR}/qremote/mime.c ) TARGET_LINK_LIBRARIES(testcase_mime qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "MIME" COMMAND testcase_mime) ADD_EXECUTABLE(testcase_mime_boundary mime_boundary_test.c ${CMAKE_SOURCE_DIR}/qremote/mime.c ) TARGET_LINK_LIBRARIES(testcase_mime_boundary # qsmtp_lib # testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "MIME_boundary_empty" COMMAND testcase_mime_boundary "\"\"") SET_TESTS_PROPERTIES(MIME_boundary_empty PROPERTIES PASS_REGULAR_EXPRESSION "^D5.6.3 boundary definition is empty\n$") ADD_TEST(NAME "MIME_boundary_long" COMMAND testcase_mime_boundary "a123456789b123456789c123456789d123456789e123456789f123456789g123456789h") SET_TESTS_PROPERTIES(MIME_boundary_long PROPERTIES PASS_REGULAR_EXPRESSION "^D5.6.3 boundary definition is too long\n$") ADD_TEST(NAME "MIME_boundary_invalid" COMMAND testcase_mime_boundary "#") SET_TESTS_PROPERTIES(MIME_boundary_invalid PROPERTIES PASS_REGULAR_EXPRESSION "^D5.6.3 boundary definition contains invalid character\n$") ADD_TEST(NAME "MIME_boundary_quoted_space" COMMAND testcase_mime_boundary "\"a \"") SET_TESTS_PROPERTIES(MIME_boundary_quoted_space PROPERTIES PASS_REGULAR_EXPRESSION "^D5.6.3 quoted boundary definition may not end in space\n$") ADD_EXECUTABLE(testcase_antispam antispam_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/antispam.c ) TARGET_LINK_LIBRARIES(testcase_antispam qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Antispam" COMMAND testcase_antispam) ADD_EXECUTABLE(testcase_all_filters all_filters_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/antispam.c ${CMAKE_SOURCE_DIR}/qsmtpd/addrsyntax.c ${CMAKE_SOURCE_DIR}/qsmtpd/backends/user_vpopm/getfile.c ) TARGET_LINK_LIBRARIES(testcase_all_filters rcptfilters qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "All_Filters" COMMAND testcase_all_filters WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/all_filters") ADD_EXECUTABLE(testcase_filter_badcc filter_badcc_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/filters/badcc.c ${CMAKE_SOURCE_DIR}/qsmtpd/addrsyntax.c ) TARGET_LINK_LIBRARIES(testcase_filter_badcc qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Filter-badCC" COMMAND testcase_filter_badcc) ADD_EXECUTABLE(testcase_filter_nomail filter_nomail_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/backends/user_vpopm/getfile.c ${CMAKE_SOURCE_DIR}/qsmtpd/filters/nomail.c ) TARGET_LINK_LIBRARIES(testcase_filter_nomail qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Filter-NoMail" COMMAND testcase_filter_nomail) ADD_EXECUTABLE(testcase_filter_fromdomain filter_fromdomain_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/filters/fromdomain.c ${CMAKE_SOURCE_DIR}/qsmtpd/addrsyntax.c ${CMAKE_SOURCE_DIR}/qsmtpd/backends/user_vpopm/getfile.c ) TARGET_LINK_LIBRARIES(testcase_filter_fromdomain qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Filter-FromDomain" COMMAND testcase_filter_fromdomain) ADD_EXECUTABLE(testcase_filter_spf filter_spf.c ${CMAKE_SOURCE_DIR}/qsmtpd/filters/spf.c ${CMAKE_SOURCE_DIR}/qsmtpd/filters/rcpt_filters.c ) TARGET_LINK_LIBRARIES(testcase_filter_spf testcase_io_lib) ADD_TEST(NAME "Filter-SPF" COMMAND testcase_filter_spf) ADD_EXECUTABLE(testcase_filter_wildcardns filter_wildcardns_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/filters/wildcardns.c ) TARGET_LINK_LIBRARIES(testcase_filter_nomail testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Filter-WildcardNS" COMMAND testcase_filter_wildcardns) ADD_EXECUTABLE(testcase_vpop_control vpop_control_test.c) TARGET_LINK_LIBRARIES(testcase_vpop_control Qsmtpd_user_vpopm qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "VPop_control" COMMAND testcase_vpop_control) ADD_EXECUTABLE(testcase_getsetting getsetting_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/backends/user_vpopm/getfile.c) TARGET_LINK_LIBRARIES(testcase_getsetting qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Getsetting" COMMAND testcase_getsetting) ADD_EXECUTABLE(testcase_netio netio_test.c) TARGET_LINK_LIBRARIES(testcase_netio qsmtp_io_lib) ADD_EXECUTABLE(test_netio_client netio_test_client.c) ADD_TEST(NAME "NetIO" COMMAND testcase_netio $) ADD_EXECUTABLE(testcase_getmxlist getmxlist_test.c ${CMAKE_SOURCE_DIR}/qremote/conn.c) TARGET_LINK_LIBRARIES(testcase_getmxlist testcase_io_lib qsmtp_lib ${MEMCHECK_LIBRARIES}) ADD_TEST(NAME "getmxlist" COMMAND testcase_getmxlist) ADD_EXECUTABLE(testcase_getmxlistv4only getmxlist_test.c ${CMAKE_SOURCE_DIR}/lib/dns_helpers.c ${CMAKE_SOURCE_DIR}/qremote/conn.c) TARGET_LINK_LIBRARIES(testcase_getmxlistv4only testcase_io_lib ${MEMCHECK_LIBRARIES}) SET_TARGET_PROPERTIES(testcase_getmxlistv4only PROPERTIES COMPILE_DEFINITIONS IPV4ONLY) ADD_TEST(NAME "getmxlist_IPv4_only" COMMAND testcase_getmxlistv4only) ADD_EXECUTABLE(testcase_connmx connmx_test.c ${CMAKE_SOURCE_DIR}/qremote/conn_mx.c) TARGET_LINK_LIBRARIES(testcase_connmx testcase_io_lib ${MEMCHECK_LIBRARIES}) ADD_TEST(NAME "Qremote_connect_mx" COMMAND testcase_connmx) # This is a brute force test just to get some "real" coverage on the file. # It will always fail, either because ${AUTOQMAIL} doesn't exist or doesn't # have the proper configuration files or simply because we do not pass it # any arguments. ADD_TEST(NAME "Qremote_noinput_noargs" COMMAND Qremote) # In case we have a proper configuration this may even check some more lines. # Since the destination address should really not exists this will still fail. ADD_TEST(NAME "Qremote_to_invalid" COMMAND Qremote invalid.invalid from@invalid.invalid to@invalid.invalid) ADD_TEST(NAME "Qremote_to_localhost" COMMAND Qremote "[127.0.0.1]" "from@invalid.invalid" "to@[127.0.0.1]") ADD_TEST(NAME "Qremote_to_localhost6" COMMAND Qremote "[::1]" "from@invalid.invalid" "to@[::1]") ADD_TEST(NAME "Qremote_to_bad_expression" COMMAND Qremote "[127.0" "from@invalid.invalid" "to@localhost") ADD_TEST(NAME "Qremote_to_bad_expression2" COMMAND Qremote "[127.0.a.v]" "from@invalid.invalid" "to@localhost") ADD_TEST(NAME "Qremote_to_ip" COMMAND Qremote "[192.0.2.19]" "from@invalid.invalid" "to@localhost") IF (AUTOQMAIL_FROM_TESTSUITE) SET_TESTS_PROPERTIES(Qremote_noinput_noargs PROPERTIES PASS_REGULAR_EXPRESSION "^Z4.3.0 internal error: Qremote called with invalid arguments\n") SET_TESTS_PROPERTIES(Qremote_to_invalid PROPERTIES PASS_REGULAR_EXPRESSION "^Z4\\.4\\.3 cannot find a mail exchanger for invalid\\.invalid\n") SET_TESTS_PROPERTIES(Qremote_to_localhost PROPERTIES PASS_REGULAR_EXPRESSION "^Z4\\.4\\.3 all mail exchangers for \\[127\\.0\\.0\\.1\\] point back to me\n") SET_TESTS_PROPERTIES(Qremote_to_localhost6 PROPERTIES PASS_REGULAR_EXPRESSION "^Z4\\.4\\.3 all mail exchangers for \\[::1\\] point back to me\n") SET_TESTS_PROPERTIES(Qremote_to_bad_expression Qremote_to_bad_expression2 PROPERTIES PASS_REGULAR_EXPRESSION "^Z4\\.3\\.0 parse error in first argument\n") SET_TESTS_PROPERTIES(Qremote_to_ip PROPERTIES PASS_REGULAR_EXPRESSION "^Z4.3.0 internal error: can't mmap\\(\\) input\n") ELSE () SET_TESTS_PROPERTIES(Qremote_noinput_noargs Qremote_to_invalid Qremote_to_localhost Qremote_to_localhost6 Qremote_to_bad_expression Qremote_to_bad_expression2 Qremote_to_ip PROPERTIES PASS_REGULAR_EXPRESSION "^Z[45]\\.[0-9]\\.[0-9] ") ENDIF () ADD_EXECUTABLE(testcase_qsdata qsdata_test.c ) TARGET_LINK_LIBRARIES(testcase_qsdata testcase_io_lib qsmtp_lib ${OPENSSL_LIBRARIES} ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Qsmtpd_data" COMMAND testcase_qsdata) # Another brute force test, this time for Qsmtpd SET(TEST_SEQUENCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/quit.cmake") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_quit.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_quit.cmake" @ONLY) ADD_TEST(NAME "Qsmtpd_quit" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_quit.cmake") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_quit_no_ips.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_quit_no_ips.cmake" @ONLY) ADD_TEST(NAME "Qsmtpd_quit_no_ips" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_quit_no_ips.cmake") # Do not add \r here, looks like CMake automatically strips it, so just # assume we are doing it right. SET_TESTS_PROPERTIES(Qsmtpd_quit Qsmtpd_quit_no_ips PROPERTIES PASS_REGULAR_EXPRESSION "^${QSMTPD_GREETING_LINE}${QSMTPD_QUIT_LINE}$") SET(TEST_SEQUENCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/postmaster_rset.cmake") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_quit.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_quit_postmaster.cmake" @ONLY) ADD_TEST(NAME "Qsmtpd_postmaster_rset" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_quit_postmaster.cmake") # Do not add \r here, looks like CMake automatically strips it, so just # assume we are doing it right. SET_TESTS_PROPERTIES(Qsmtpd_postmaster_rset PROPERTIES PASS_REGULAR_EXPRESSION "^${QSMTPD_GREETING_LINE}${QSMTPD_HELO_RESPONSE}250 2\\.0\\.0 ok\n250 2\\.0\\.0 ok\n250-[^\n ]*\n250-ENHANCEDSTATUSCODES\n250-PIPELINING\n250-8BITMIME\n(.*\n)?250 SIZE( [0-9]+)?\n250 2\\.1\\.5 sender <> is syntactically correct\n250 2\\.1\\.0 recipient OK\n250 2\\.0\\.0 ok\n503 5\\.5\\.1 Bad sequence of commands\n${QSMTPD_QUIT_LINE}$") SET(TEST_SEQUENCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/bounce_multi_rcpt.cmake") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_quit.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_bad_bounce.cmake" @ONLY) ADD_TEST(NAME "Qsmtpd_bad_bounce" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_bad_bounce.cmake") # Do not add \r here, looks like CMake automatically strips it, so just # assume we are doing it right. SET_TESTS_PROPERTIES(Qsmtpd_bad_bounce PROPERTIES PASS_REGULAR_EXPRESSION "^${QSMTPD_GREETING_LINE}250-[^\n ]*\n250-ENHANCEDSTATUSCODES\n250-PIPELINING\n250-8BITMIME\n(.*\n)?250 SIZE( [0-9]+)?\n250 2\\.1\\.5 sender <> is syntactically correct\n250 2\\.1\\.0 recipient OK\n550 5\\.5\\.3 bounce messages must not have more than one recipient\n554 5\\.1\\.1 no valid recipients\n${QSMTPD_QUIT_LINE}$") SET(TEST_SEQUENCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmd_args.cmake") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_quit.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_cmd_args.cmake" @ONLY) ADD_TEST(NAME "Qsmtpd_cmd_args" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_cmd_args.cmake") # Do not add \r here, looks like CMake automatically strips it, so just # assume we are doing it right. SET_TESTS_PROPERTIES(Qsmtpd_cmd_args PROPERTIES PASS_REGULAR_EXPRESSION "^${QSMTPD_GREETING_LINE}${QSMTPD_HELO_RESPONSE}${QSMTPD_HELO_RESPONSE}500 5\\.5\\.2 command syntax error\n250-[^\n ]*\n250-ENHANCEDSTATUSCODES\n250-PIPELINING\n250-8BITMIME\n(.*\n)?250 SIZE( [0-9]+)?\n501 5\\.5\\.2 unrecognized command parameter\n250 2\\.1\\.5 sender <> is syntactically correct\n500 5\\.5\\.2 command syntax error\n501 5\\.1\\.3 domain of mail address is syntactically incorrect\n250 2\\.0\\.0 ok\n250 2\\.1\\.5 sender <> is syntactically correct\n(500 5\\.5\\.2 command syntax error\n250 2\\.0\\.0 ok\n)+500-5\\.5\\.2 line too long\n500-5\\.5\\.2 This is usually a bug in your mail client\n500 5\\.5\\.2 Try to use a different encoding like quoted-printable for this mail.\n250 2.0.0 ok\n501 5\\.1\\.3 domain of mail address is syntactically incorrect\n250 2\\.0\\.0 ok\n500 5\\.5\\.2 command syntax error\n503 5\\.5\\.1 SMTP command sent after end of PIPELINING command group\n503 5\\.5\\.1 Bad sequence of commands\n${QSMTPD_QUIT_LINE}$") SET(TEST_SEQUENCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_bad_args.cmake") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_quit.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_bad_args.cmake" @ONLY) ADD_TEST(NAME "Qsmtpd_bad_args" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_bad_args.cmake") # Do not add \r here, looks like CMake automatically strips it, so just # assume we are doing it right. SET_TESTS_PROPERTIES(Qsmtpd_bad_args PROPERTIES PASS_REGULAR_EXPRESSION "^${QSMTPD_GREETING_LINE}500 5\\.5\\.2 command syntax error\n250-[^\n ]*\n250-ENHANCEDSTATUSCODES\n250-PIPELINING\n250-8BITMIME\n(.*\n)?250 SIZE( [0-9]+)?\n500 5\\.5\\.2 command syntax error\n252 2\\.1\\.5 send some mail, I'll do my very best\n500 5\\.5\\.2 command syntax error\n(500 5\\.5\\.2 command syntax error\n250 2\\.0\\.0 ok\n)+250 [^\n]+\n250 2\\.1\\.5 sender is syntactically correct\n${QSMTPD_QUIT_LINE}$") SET(TEST_SEQUENCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/bad_pipelining.cmake") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_quit.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_bad_pipelining.cmake" @ONLY) ADD_TEST(NAME "Qsmtpd_bad_pipelining" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_bad_pipelining.cmake") # Do not add \r here, looks like CMake automatically strips it, so just # assume we are doing it right. SET_TESTS_PROPERTIES(Qsmtpd_bad_pipelining PROPERTIES PASS_REGULAR_EXPRESSION "^${QSMTPD_GREETING_LINE}${QSMTPD_HELO_RESPONSE}550 5\\.5\\.0 you must wait for my reply\n503 5\\.5\\.1 Bad sequence of commands\n503 5\\.5\\.1 Bad sequence of commands\n${QSMTPD_QUIT_LINE}$") SET(TEST_LOCAL_IP4 "203.0.113.42") SET(TEST_REMOTE_IP4 "203.0.113.24") SET(TEST_LOCAL_IP6 "2001:db8::42:42") SET(TEST_REMOTE_IP6 "2001:db8::24:24") SET(TEST_SEQUENCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/no_auth_submission.cmake") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_submission.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_no_auth_submission.cmake" @ONLY) ADD_TEST(NAME "Qsmtpd_no_auth_submission" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_no_auth_submission.cmake") # Do not add \r here, looks like CMake automatically strips it, so just # assume we are doing it right. SET_TESTS_PROPERTIES(Qsmtpd_no_auth_submission PROPERTIES PASS_REGULAR_EXPRESSION "^${QSMTPD_GREETING_LINE}(250-[^\n]+\n)+250-AUTH [^\n]+\n(250-[^\n]+\n)*250 SIZE( [0-9]+)?\n550 5.7.1 authentication required\n${QSMTPD_QUIT_LINE}$") SET(TEST_LOCAL_IP4 "192.0.2.19") SET(TEST_REMOTE_IP4 "203.0.113.24") SET(TEST_LOCAL_IP6 "2001:db8::123") SET(TEST_REMOTE_IP6 "2001:db8::24:24") SET(TEST_SEQUENCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_more_commands.cmake") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_submission.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_more_commands.cmake" @ONLY) ADD_TEST(NAME "Qsmtpd_more_commands" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_more_commands.cmake") # Do not add \r here, looks like CMake automatically strips it, so just # assume we are doing it right. IF (AUTOQMAIL_FROM_TESTSUITE) # require STARTTLS in the testsuite, the certificates were copied at the proper place SET_TESTS_PROPERTIES(Qsmtpd_more_commands PROPERTIES PASS_REGULAR_EXPRESSION "^${QSMTPD_GREETING_LINE}(250-[^\n]+\n)+250-AUTH [^\n]+\n(250-[A-Z8][^\n]+\n)*250-STARTTLS\n250 SIZE 1024\n235 2\\.7\\.0 ok, go ahead\n452 4\\.3\\.1 Requested action not taken: insufficient system storage\n${QSMTPD_HELO_RESPONSE}503 5.5.1 Bad sequence of commands\n${QSMTPD_QUIT_LINE}$") ELSE () # when using the system control directory ignore if STARTTLS is given or not # AUTH without STARTTLS may be permitted or not # databytes may be set as small as in this testcase (unlikely), set to a higher value or not set at all SET_TESTS_PROPERTIES(Qsmtpd_more_commands PROPERTIES PASS_REGULAR_EXPRESSION "^${QSMTPD_GREETING_LINE}(250-[^\n]+\n)+250 SIZE( [0-9]+)?\n(235 2\\.7\\.0 ok, go ahead\n(250 2\\.1\\.5 sender <> is syntactically correct|452 4\\.3\\.1 Requested action not taken: insufficient system storage)|503 5\\.5\\.1 Bad sequence of commands\n550 5\\.7\\.1 authentication required)\n${QSMTPD_HELO_RESPONSE}503 5.5.1 Bad sequence of commands\n${QSMTPD_QUIT_LINE}$") ENDIF () SET(TEST_SEQUENCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/broken_helo.cmake") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Qsmtpd_submission.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_broken_helo.cmake" @ONLY) ADD_TEST(NAME "Qsmtpd_broken_helo" COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/Qsmtpd_broken_helo.cmake") # Do not add \r here, looks like CMake automatically strips it, so just # assume we are doing it right. SET_TESTS_PROPERTIES(Qsmtpd_broken_helo PROPERTIES PASS_REGULAR_EXPRESSION "^${QSMTPD_GREETING_LINE}(500 5\\.5\\.2 command syntax error\n250 2.0.0 ok\n)+${QSMTPD_QUIT_LINE}$") ADD_EXECUTABLE(testcase_ipme ipme_test.c) TARGET_LINK_LIBRARIES(testcase_ipme qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "IPme" COMMAND testcase_ipme) ADD_EXECUTABLE(testcase_ehlo_parsing ehlo_test.c ${CMAKE_SOURCE_DIR}/qremote/greeting.c ) TARGET_LINK_LIBRARIES(testcase_ehlo_parsing ${MEMCHECK_LIBRARIES} testcase_io_lib ) ADD_TEST(NAME "EHLO_parsing" COMMAND testcase_ehlo_parsing) ADD_EXECUTABLE(testcase_vpop_user_exists userexists_test.c) TARGET_LINK_LIBRARIES(testcase_vpop_user_exists Qsmtpd_user_vpopm qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "VPop_user_exists" COMMAND testcase_vpop_user_exists WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/user_exists/") ADD_EXECUTABLE(testcase_vpop_vget_dir vpop_vget_dir_test.c cdb_entries.h) TARGET_LINK_LIBRARIES(testcase_vpop_vget_dir Qsmtpd_user_vpopm qsmtp_lib testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "VPop_vget_dir" COMMAND testcase_vpop_vget_dir "${CMAKE_CURRENT_SOURCE_DIR}") ADD_EXECUTABLE(testcase_qrclient qrclient_test.c ../qremote/client.c ../qremote/status.c ) TARGET_LINK_LIBRARIES(testcase_qrclient testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Qrclient" COMMAND testcase_qrclient) ADD_EXECUTABLE(testcase_qrreply qrreply_test.c ../qremote/reply.c ) TARGET_LINK_LIBRARIES(testcase_qrreply testcase_io_lib ${MEMCHECK_LIBRARIES} ) ADD_TEST(NAME "Qrreply" COMMAND testcase_qrreply) ADD_EXECUTABLE(testcase_starttlsr starttlsr_test.c ../lib/ssl_timeoutio.c ../qremote/starttlsr.c) TARGET_LINK_LIBRARIES(testcase_starttlsr testcase_io_lib qsmtp_lib ${OPENSSL_LIBRARIES} ) ADD_TEST(NAME "STARTTLSr" COMMAND testcase_starttlsr WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/tlsclientciphers_good") SET_TESTS_PROPERTIES(STARTTLSr PROPERTIES PASS_REGULAR_EXPRESSION "^LOG OUTPUT\\[3\\]: STARTTLS failed at \\[192.0.2.4\\]: 421 \nRETURN VALUE: 1003\n") ADD_TEST(NAME "STARTTLSr_no_partner_conf" COMMAND testcase_starttlsr noconf.example.com WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/tlsclientciphers_good") SET_TESTS_PROPERTIES(STARTTLSr_no_partner_conf PROPERTIES PASS_REGULAR_EXPRESSION "^LOG OUTPUT\\[3\\]: STARTTLS failed at noconf\\.example\\.com: 421 \nRETURN VALUE: 1003\n") ADD_TEST(NAME "STARTTLSr_tlsciphers_good" COMMAND testcase_starttlsr badconf.example.com WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/tlsclientciphers_good") SET_TESTS_PROPERTIES(STARTTLSr_tlsciphers_good PROPERTIES PASS_REGULAR_EXPRESSION "^LOG OUTPUT\\[3\\]: STARTTLS failed at badconf\\.example\\.com: 421 \nRETURN VALUE: 1003\n") ADD_TEST(NAME "STARTTLSr_tlsciphers_bad" COMMAND testcase_starttlsr badconf.example.com WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/tlsclientciphers_bad") SET_TESTS_PROPERTIES(STARTTLSr_tlsciphers_bad PROPERTIES PASS_REGULAR_EXPRESSION "^CONFIG error: can't set ciphers\n$") ADD_TEST(NAME "STARTTLSr_bad_partner_certs" COMMAND testcase_starttlsr badconf.example.com WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/invalid_pem") SET_TESTS_PROPERTIES(STARTTLSr_bad_partner_certs PROPERTIES PASS_REGULAR_EXPRESSION "^Z4\\.5\\.0 TLS unable to load control/tlshosts/badconf\\.example\\.com.\\pem: expected SSL testcase error\\; connecting to badconf\\.example\\.com\nRETURN VALUE: -1\n$") ADD_TEST(NAME "STARTTLSr_tlsciphers_dir" COMMAND testcase_starttlsr badconf.example.com WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/tlsclientciphers_dir") SET_TESTS_PROPERTIES(STARTTLSr_tlsciphers_dir PROPERTIES PASS_REGULAR_EXPRESSION "^CONFIG error: can't open tlsclientciphers\n$") ADD_TEST(NAME "STARTTLSr_matching_tlshost" COMMAND testcase_starttlsr testcert.example.org WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/matching_tlshost") SET_TESTS_PROPERTIES(STARTTLSr_matching_tlshost PROPERTIES PASS_REGULAR_EXPRESSION "^LOG OUTPUT\\[3\\]: STARTTLS failed at testcert.example.org: 421 \nRETURN VALUE: 1003\n$") ADD_TEST(NAME "STARTTLSr_conn_failure" COMMAND testcase_starttlsr testcert.example.org "220 " WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/matching_tlshost") SET_TESTS_PROPERTIES(STARTTLSr_conn_failure PROPERTIES PASS_REGULAR_EXPRESSION "^LOG OUTPUT\\[3\\]: TLS connection failed at testcert\\.example\\.org: expected error case\nRETURN VALUE: ETIMEDOUT\n$") ADD_TEST(NAME "STARTTLSr_conn_failure_multiline" COMMAND testcase_starttlsr testcert.example.org "220-;220 " WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/matching_tlshost") SET_TESTS_PROPERTIES(STARTTLSr_conn_failure_multiline PROPERTIES PASS_REGULAR_EXPRESSION "^LOG OUTPUT\\[3\\]: TLS connection failed at testcert\\.example\\.org: expected error case\nRETURN VALUE: EPIPE\n$") # the last 220 should never be read, the tests checks that the 221 line will be shown ADD_TEST(NAME "STARTTLSr_invalid_multiline" COMMAND testcase_starttlsr testcert.example.org "220-;221-;220 " WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/starttlsr/matching_tlshost") SET_TESTS_PROPERTIES(STARTTLSr_invalid_multiline PROPERTIES PASS_REGULAR_EXPRESSION "^LOG OUTPUT\\[3\\]: STARTTLS failed at testcert.example.org: 221-\nRETURN VALUE: 1003\n$") ADD_EXECUTABLE(testcase_queue_envelope queue_envelope_test.c ${CMAKE_SOURCE_DIR}/qsmtpd/queue.c ) TARGET_LINK_LIBRARIES(testcase_queue_envelope qsmtp_lib testcase_io_lib ${OPENSSL_LIBRARIES} ) ADD_TEST(NAME "Queue_envelope" COMMAND testcase_queue_envelope) ADD_EXECUTABLE(testcase_cmd_rcpt cmd_rcpt_test.c ${CMAKE_SOURCE_DIR}/lib/fmt.c ${CMAKE_SOURCE_DIR}/qsmtpd/commands.c) TARGET_LINK_LIBRARIES(testcase_cmd_rcpt testcase_io_lib) ADD_TEST(NAME "Qsmtpd_cmd_RCPT" COMMAND testcase_cmd_rcpt) ADD_EXECUTABLE(testcase_cmd_from cmd_from_test.c ${CMAKE_SOURCE_DIR}/lib/dns_helpers.c ${CMAKE_SOURCE_DIR}/lib/fmt.c ${CMAKE_SOURCE_DIR}/qsmtpd/addrparse.c ${CMAKE_SOURCE_DIR}/qsmtpd/addrsyntax.c ${CMAKE_SOURCE_DIR}/qsmtpd/commands.c ${CMAKE_SOURCE_DIR}/qsmtpd/xtext.c) TARGET_LINK_LIBRARIES(testcase_cmd_from testcase_io_lib) ADD_TEST(NAME "Qsmtpd_cmd_FROM" COMMAND testcase_cmd_from) ADD_EXECUTABLE(testcase_ssl_pp ssl_pp.c ${CMAKE_SOURCE_DIR}/qremote/reply.c ${CMAKE_SOURCE_DIR}/qremote/starttlsr.c ${CMAKE_SOURCE_DIR}/qsmtpd/starttls.c ${CMAKE_SOURCE_DIR}/lib/tls.c ${CMAKE_SOURCE_DIR}/lib/netio.c ${CMAKE_SOURCE_DIR}/lib/ssl_timeoutio.c ) TARGET_LINK_LIBRARIES(testcase_ssl_pp qsmtp_lib ${OPENSSL_LIBRARIES} ) FOREACH(_ssl_test IN ITEMS simple simple_clc tlsclients_dir simple_clc_tlsclients simple_clc_clientca simple_clientca relay_no_name relay_other relay_multi_first relay_multi_last matching_servercert matching_wildcard nonmatching_servercert nonmatching_wildcard SubjAN_match SubjAN2_match SubjAN_cn servercert_no_name expired) SET(_tgt_dir "${CMAKE_CURRENT_BINARY_DIR}/ssl_pp/${_ssl_test}") FILE(MAKE_DIRECTORY "${_tgt_dir}/control") FOREACH(_pem IN ITEMS rsa512 dh2048) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/${_pem}.pem "${_tgt_dir}/control/${_pem}.pem" COPYONLY) ENDFOREACH() UNSET(_ssl_test_arg) UNSET(_ssl_client_key) UNSET(_ssl_server_key) IF (_ssl_test STREQUAL "simple") SET(_ssl_server_key "valid1024.key") ELSEIF (_ssl_test STREQUAL "simple_clc") SET(_ssl_client_key "valid1024.key") SET(_ssl_server_key "valid1024.key") ELSEIF (_ssl_test STREQUAL "tlsclients_dir") SET(_ssl_server_key "valid1024.key") FILE(MAKE_DIRECTORY "${_tgt_dir}/control/tlsclients") SET(_ssl_test_arg "-sEISDIR") ELSEIF (_ssl_test STREQUAL "simple_clc_tlsclients" OR _ssl_test STREQUAL "simple_clc_clientca") SET(_ssl_client_key "valid1024.key") SET(_ssl_server_key "valid1024.key") FILE(WRITE "${_tgt_dir}/control/tlsclients" "testcert.example.org\n") IF (_ssl_test STREQUAL "simple_clc_clientca") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/valid1024.crt "${_tgt_dir}/control/clientca.pem" COPYONLY) SET(_ssl_test_arg "-s1") ENDIF () ELSEIF (_ssl_test STREQUAL "simple_clientca") SET(_ssl_server_key "valid1024.key") FILE(WRITE "${_tgt_dir}/control/tlsclients" "testcert.example.org\n") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/valid1024.crt "${_tgt_dir}/control/clientca.pem" COPYONLY) ELSEIF (_ssl_test STREQUAL "relay_no_name") SET(_ssl_client_key "noname.key") SET(_ssl_server_key "valid1024.key") FILE(WRITE "${_tgt_dir}/control/tlsclients" "testcert.example.org\n") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/noname.crt "${_tgt_dir}/control/clientca.pem" COPYONLY) ELSEIF (_ssl_test STREQUAL "relay_other") SET(_ssl_client_key "valid1024_san.key") SET(_ssl_server_key "valid1024.key") FILE(WRITE "${_tgt_dir}/control/tlsclients" "testcert.example.org\n") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/noname.crt "${_tgt_dir}/control/clientca.pem" COPYONLY) ELSEIF (_ssl_test STREQUAL "relay_multi_first" OR _ssl_test STREQUAL "relay_multi_last") SET(_ssl_client_key "valid1024.key") SET(_ssl_server_key "valid1024.key") FILE(WRITE "${_tgt_dir}/control/tlsclients" "testcert.example.org\n") FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/noname.crt NONAME_CRT) FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/valid1024.crt VALID_CRT) IF (_ssl_test STREQUAL "relay_multi_first") FILE(WRITE "${_tgt_dir}/control/clientca.pem" "${VALID_CRT}${NONAME_CRT}") ELSE () FILE(WRITE "${_tgt_dir}/control/clientca.pem" "${NONAME_CRT}${VALID_CRT}") ENDIF () SET(_ssl_test_arg "-s1") ELSEIF (_ssl_test STREQUAL "simple_clc_tlsclients") SET(_ssl_client_key "valid1024.key") SET(_ssl_server_key "valid1024.key") FILE(WRITE "${_tgt_dir}/control/tlsclients" "testcert.example.org\n") ELSEIF (_ssl_test STREQUAL "matching_servercert") FILE(MAKE_DIRECTORY "${_tgt_dir}/control/tlshosts") SET(_ssl_server_key "valid1024.key") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/valid1024.crt "${_tgt_dir}/control/tlshosts/testcert.example.org.pem" COPYONLY) ELSEIF (_ssl_test STREQUAL "matching_wildcard") FILE(MAKE_DIRECTORY "${_tgt_dir}/control/tlshosts") SET(_ssl_server_key "wildcard1024.key") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/wildcard1024.crt "${_tgt_dir}/control/tlshosts/testcert.example.org.pem" COPYONLY) ELSEIF (_ssl_test STREQUAL "nonmatching_servercert") FILE(MAKE_DIRECTORY "${_tgt_dir}/control/tlshosts") SET(_ssl_server_key "valid1024.key") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/valid1024.crt "${_tgt_dir}/control/tlshosts/testcert.example.net.pem" COPYONLY) SET(_ssl_test_arg "-ftestcert.example.net" "-lunable to verify testcert.example.net: received certificate for 'testcert.example.org'" "-iEDONE") ELSEIF (_ssl_test STREQUAL "nonmatching_wildcard") FILE(MAKE_DIRECTORY "${_tgt_dir}/control/tlshosts") SET(_ssl_server_key "wildcard1024.key") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/wildcard1024.crt "${_tgt_dir}/control/tlshosts/testcert.example.net.pem" COPYONLY) SET(_ssl_test_arg "-ftestcert.example.net" "-lunable to verify testcert.example.net: received certificate for '*.example.org'" "-iEDONE") ELSEIF (_ssl_test STREQUAL "SubjAN_match") FILE(MAKE_DIRECTORY "${_tgt_dir}/control/tlshosts") SET(_ssl_server_key "valid1024_san.key") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/valid1024_san.crt "${_tgt_dir}/control/tlshosts/testcert.example.org.pem" COPYONLY) ELSEIF (_ssl_test STREQUAL "SubjAN2_match") FILE(MAKE_DIRECTORY "${_tgt_dir}/control/tlshosts") SET(_ssl_server_key "valid1024_san2.key") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/valid1024_san2.crt "${_tgt_dir}/control/tlshosts/testcert.example.org.pem" COPYONLY) ELSEIF (_ssl_test STREQUAL "SubjAN_cn") FILE(MAKE_DIRECTORY "${_tgt_dir}/control/tlshosts") SET(_ssl_server_key "valid1024_san_cn.key") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/valid1024_san_cn.crt "${_tgt_dir}/control/tlshosts/testcert.example.org.pem" COPYONLY) SET(_ssl_test_arg "-lunable to verify testcert.example.org: received certificate for 'other.example.org'" "-iEDONE") ELSEIF (_ssl_test STREQUAL "servercert_no_name") FILE(MAKE_DIRECTORY "${_tgt_dir}/control/tlshosts") SET(_ssl_server_key "noname.key") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/noname.crt "${_tgt_dir}/control/tlshosts/testcert.example.org.pem" COPYONLY) SET(_ssl_test_arg "-lunable to verify testcert.example.org: certificate contains no valid commonName" "-iEDONE") ELSEIF (_ssl_test STREQUAL "expired") FILE(MAKE_DIRECTORY "${_tgt_dir}/control/tlshosts") SET(_ssl_server_key "expired.key") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/expired.crt "${_tgt_dir}/control/tlshosts/testcert.example.org.pem" COPYONLY) SET(_ssl_test_arg "-lunable to verify testcert.example.org with control/tlshosts/testcert.example.org.pem: certificate has expired" "-iEDONE") ENDIF () IF (_ssl_client_key) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/${_ssl_client_key} "${_tgt_dir}/control/clientcert.pem" COPYONLY) ENDIF () IF (_ssl_server_key) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ssl_pp/${_ssl_server_key} "${_tgt_dir}/control/servercert.pem" COPYONLY) ENDIF (_ssl_server_key) ADD_TEST(NAME "SSL_pp_${_ssl_test}" COMMAND testcase_ssl_pp ${_ssl_test_arg} WORKING_DIRECTORY "${_tgt_dir}") ENDFOREACH() ADD_SUBDIRECTORY(smtproutes)