diff options
author | jpadkins <jacobpadkins@gmail.com> | 2017-03-17 22:32:44 +0300 |
---|---|---|
committer | jpadkins <jacobpadkins@gmail.com> | 2017-03-17 22:32:44 +0300 |
commit | 19e125587589d435a711594d9cd3860ae4c72d47 (patch) | |
tree | b9faafb3c36ac74ac7ee49e5a28e8178103fa4bd /check/magma | |
parent | 8e8ddcc2a23abafff04f5b0efdd3a5b42d394ad2 (diff) | |
parent | b6772e9aade6c99ca248363f457ba95eda4a12e6 (diff) |
Merge remote-tracking branch 'upstream/feature/tls-error-investigation' into feature/smtp-auth-test
Diffstat (limited to 'check/magma')
-rw-r--r-- | check/magma/core/system_check.c | 5 | ||||
-rw-r--r-- | check/magma/servers/imap/imap_check.h | 4 | ||||
-rw-r--r-- | check/magma/servers/imap/imap_check_network.c | 29 | ||||
-rw-r--r-- | check/magma/servers/pop/pop_check.c | 37 | ||||
-rw-r--r-- | check/magma/servers/pop/pop_check.h | 2 | ||||
-rw-r--r-- | check/magma/servers/pop/pop_check_network.c | 32 | ||||
-rw-r--r-- | check/magma/servers/smtp/checkers_check.c | 87 | ||||
-rw-r--r-- | check/magma/servers/smtp/smtp_check.c | 10 | ||||
-rw-r--r-- | check/magma/servers/smtp/smtp_check_network.c | 5 |
9 files changed, 120 insertions, 91 deletions
diff --git a/check/magma/core/system_check.c b/check/magma/core/system_check.c index 0812cb3a..6d5c4617 100644 --- a/check/magma/core/system_check.c +++ b/check/magma/core/system_check.c @@ -27,8 +27,8 @@ bool_t check_system_signames(void) { bool_t check_system_errnonames(void) { - chr_t buf[1024]; bool_t result = true; + chr_t *buffer1 = MEMORYBUF(1024), *buffer2 = MEMORYBUF(1024); if (!status()) { return result; @@ -37,7 +37,8 @@ bool_t check_system_errnonames(void) { for (uint64_t i = 1; i < _sys_nerr; i++) { // Errors 41 and 58 are aliases, and strerror will return unknown instead of the alias name.. - if (st_cmp_ci_starts(NULLER(strerror(i)), PLACER("Unknown", 7)) && st_cmp_cs_eq(NULLER(errno_name(i, buf, 1024)), NULLER(strerror(i)))) { + if (st_cmp_ci_starts(NULLER(strerror_r(i, buffer1, 1024)), PLACER("Unknown", 7)) && + st_cmp_cs_eq(NULLER(errno_name(i, buffer2, 1024)), NULLER(strerror_r(i, buffer2, 1024)))) { result = false; } } diff --git a/check/magma/servers/imap/imap_check.h b/check/magma/servers/imap/imap_check.h index 402faf6a..8ea8c10f 100644 --- a/check/magma/servers/imap/imap_check.h +++ b/check/magma/servers/imap/imap_check.h @@ -8,8 +8,8 @@ #define IMAP_CHECK_H /// imap_check_network.c -bool_t check_imap_client_read_lines_to_end(client_t* client, chr_t* token); -bool_t check_imap_network_basic_sthread(stringer_t* errmsg, uint32_t port); +bool_t check_imap_client_read_lines_to_end(client_t *client, chr_t *tag); +bool_t check_imap_network_basic_sthread(stringer_t *errmsg, uint32_t port); Suite * suite_check_imap(void); diff --git a/check/magma/servers/imap/imap_check_network.c b/check/magma/servers/imap/imap_check_network.c index 66781ebd..21192b51 100644 --- a/check/magma/servers/imap/imap_check_network.c +++ b/check/magma/servers/imap/imap_check_network.c @@ -1,5 +1,6 @@ + /** - * @file /magma/check/magma/servers/smtp/smtp_check_helpers.c + * @file /magma/check/magma/servers/imap/imap_check_helpers.c * * @brief Functions used to test IMAP connections over a network connection. * @@ -8,20 +9,19 @@ #include "magma_check.h" /** - * Calls client_read_line on a client until it finds a line matching "<token> OK" + * @brief Calls client_read_line on a client until it finds a line matching "<token> OK" * * @param client The client to read from (which should be connected to an IMAP server). * @param token The unique token that identifies the current imap command dialogue. * * @return Returns true if client_read_line was successful until the last line was found. - * specified in num and there was no error. Otherwise returns false. + * specified in num and there was no error. Otherwise returns false. */ -bool_t check_imap_client_read_lines_to_end(client_t *client, chr_t *token) { +bool_t check_imap_client_read_lines_to_end(client_t *client, chr_t *tag) { bool_t outcome = false; - stringer_t *last_line = st_merge("ss", NULLER(token), NULLER(" OK")); + stringer_t *last_line = st_merge("ss", NULLER(tag), NULLER(" OK")); - // TODO: Add a timeout mechanism to client_read_line and update this function. while (!outcome && client_read_line(client) > 0) { if (!st_cmp_cs_starts(&client->line, last_line)) outcome = true; } @@ -35,8 +35,8 @@ bool_t check_imap_network_basic_sthread(stringer_t *errmsg, uint32_t port) { client_t *client = NULL; // Check the initial response. - if (!(client = client_connect("localhost", port)) || client_read_line(client) <= 0 || (client->status != 1) || - st_cmp_cs_starts(&(client->line), NULLER("* OK"))) { + if (!(client = client_connect("localhost", port)) || !net_set_timeout(client->sockd, 20, 20) || + client_read_line(client) <= 0 || (client->status != 1) || st_cmp_cs_starts(&(client->line), NULLER("* OK"))) { st_sprint(errmsg, "Failed to connect with the IMAP server."); client_close(client); @@ -70,10 +70,19 @@ bool_t check_imap_network_basic_sthread(stringer_t *errmsg, uint32_t port) { return false; } - // Test the LOGOUT command. - else if (client_print(client, "A4 LOGOUT\r\n") <= 0 || !check_imap_client_read_lines_to_end(client, "A4") || + // Test the CLOSE command. + else if (client_print(client, "A4 CLOSE\r\n") <= 0 || !check_imap_client_read_lines_to_end(client, "A4") || client_status(client) != 1 || st_cmp_cs_starts(&(client->line), NULLER("A4 OK"))) { + st_sprint(errmsg, "Failed to return a successful state after CLOSE."); + client_close(client); + return false; + } + + // Test the LOGOUT command. + else if (client_print(client, "A5 LOGOUT\r\n") <= 0 || !check_imap_client_read_lines_to_end(client, "A5") || + client_status(client) != 1 || st_cmp_cs_starts(&(client->line), NULLER("A5 OK"))) { + st_sprint(errmsg, "Failed to return a successful state after LOGOUT."); client_close(client); return false; diff --git a/check/magma/servers/pop/pop_check.c b/check/magma/servers/pop/pop_check.c index d70ff331..613eb2d6 100644 --- a/check/magma/servers/pop/pop_check.c +++ b/check/magma/servers/pop/pop_check.c @@ -6,22 +6,42 @@ #include "magma_check.h" -START_TEST (check_pop_network_basic_s) { +START_TEST (check_pop_network_basic_tcp_s) { log_disable(); bool_t outcome = true; - server_t *server = NULL; + server_t *tcp = NULL; stringer_t *errmsg = MANAGEDBUF(1024); - if (!(server = servers_get_by_protocol(POP, false))) { - st_sprint(errmsg, "No POP servers were configured and available for testing."); + if (status() && !(tcp = servers_get_by_protocol(POP, false))) { + st_sprint(errmsg, "No POP servers were configured to support TCP connections."); outcome = false; } - else if (status()) { - outcome = check_pop_network_basic_sthread(errmsg, server->network.port); + else if (status() && check_pop_network_basic_sthread(errmsg, tcp->network.port, false)) { + outcome = false; + } + + log_test("POP / NETWORK / BASIC / TCP / SINGLE THREADED:", errmsg); + ck_assert_msg(outcome, st_char_get(errmsg)); +} +END_TEST + +START_TEST (check_pop_network_basic_tls_s) { + + log_disable(); + bool_t outcome = true; + server_t *tls = NULL; + stringer_t *errmsg = MANAGEDBUF(1024); + + if (status() && !(tls = servers_get_by_protocol(POP, true))) { + st_sprint(errmsg, "No POP servers were configured to support TLS connections."); + outcome = false; + } + else if (status() && !check_pop_network_basic_sthread(errmsg, tls->network.port, true)) { + outcome = false; } - log_test("POP / NETWORK / BASIC / SINGLE THREADED:", errmsg); + log_test("POP / NETWORK / BASIC / TLS / SINGLE THREADED:", errmsg); ck_assert_msg(outcome, st_char_get(errmsg)); } END_TEST @@ -30,7 +50,8 @@ Suite * suite_check_pop(void) { Suite *s = suite_create("\tPOP"); - suite_check_testcase(s, "POP", "POP Network Basic/S", check_pop_network_basic_s); + suite_check_testcase(s, "POP", "POP Network Basic / TCP/S", check_pop_network_basic_tcp_s); + suite_check_testcase(s, "POP", "POP Network Basic / TLS/S", check_pop_network_basic_tls_s); return s; } diff --git a/check/magma/servers/pop/pop_check.h b/check/magma/servers/pop/pop_check.h index ba55f524..dbc09d6c 100644 --- a/check/magma/servers/pop/pop_check.h +++ b/check/magma/servers/pop/pop_check.h @@ -9,7 +9,7 @@ /// pop_check_network.c bool_t check_pop_client_read_lines_to_end(client_t *client); -bool_t check_pop_network_basic_sthread(stringer_t *errmsg, uint32_t port); +bool_t check_pop_network_basic_sthread(stringer_t *errmsg, uint32_t port, bool_t secure); /// pop_check.c Suite * suite_check_pop(void); diff --git a/check/magma/servers/pop/pop_check_network.c b/check/magma/servers/pop/pop_check_network.c index 48c1dc58..16d84fc3 100644 --- a/check/magma/servers/pop/pop_check_network.c +++ b/check/magma/servers/pop/pop_check_network.c @@ -16,20 +16,20 @@ */ bool_t check_pop_client_read_lines_to_end(client_t *client) { - // TODO: Add a timeout mechanism to client_read_line and update this function. while (client_read_line(client) > 0) { if (!st_cmp_cs_eq(&(client->line), NULLER(".\r\n"))) return true; } return false; } -bool_t check_pop_network_basic_sthread(stringer_t *errmsg, uint32_t port) { +bool_t check_pop_network_basic_sthread(stringer_t *errmsg, uint32_t port, bool_t secure) { client_t *client = NULL; // Connect the client. - if (!(client = client_connect("localhost", port)) || client_read_line(client) <= 0 || - client_status(client) != 1 || st_cmp_cs_starts(&(client->line), NULLER("+OK"))) { + if (!(client = client_connect("localhost", port)) || (secure && client_secure(client)) || + !net_set_timeout(client->sockd, 20, 20) || client_read_line(client) <= 0 || client_status(client) != 1 || + st_cmp_cs_starts(&(client->line), NULLER("+OK"))) { st_sprint(errmsg, "Failed to connect with the POP server."); client_close(client); @@ -37,8 +37,8 @@ bool_t check_pop_network_basic_sthread(stringer_t *errmsg, uint32_t port) { } // Test the USER command. - if (client_print(client, "USER princess\r\n") <= 0 || client_read_line(client) <= 0 || - client_status(client) != 1 || st_cmp_cs_starts(&(client->line), NULLER("+OK"))) { + else if (client_print(client, "USER princess\r\n") != 15 || client_read_line(client) <= 0 || + client_status(client) != 1 || st_cmp_cs_starts(&(client->line), NULLER("+OK"))) { st_sprint(errmsg, "Failed to return a successful state after USER."); client_close(client); @@ -46,8 +46,8 @@ bool_t check_pop_network_basic_sthread(stringer_t *errmsg, uint32_t port) { } // Test the PASS command. - if (client_print(client, "PASS password\r\n") <= 0 || client_read_line(client) <= 0 || - client_status(client) != 1 || st_cmp_cs_starts(&(client->line), NULLER("+OK"))) { + else if (client_print(client, "PASS password\r\n") != 15 || client_read_line(client) <= 0 || + client_status(client) != 1 || st_cmp_cs_starts(&(client->line), NULLER("+OK"))) { st_sprint(errmsg, "Failed to return a successful state after USER."); client_close(client); @@ -55,8 +55,8 @@ bool_t check_pop_network_basic_sthread(stringer_t *errmsg, uint32_t port) { } // Test the LIST command. - if (client_print(client, "LIST\r\n") <= 0 || !check_pop_client_read_lines_to_end(client) || - client_status(client) != 1) { + else if (client_print(client, "LIST\r\n") != 6 || !check_pop_client_read_lines_to_end(client) || + client_status(client) != 1) { st_sprint(errmsg, "Failed to return a successful state after LIST."); client_close(client); @@ -64,8 +64,8 @@ bool_t check_pop_network_basic_sthread(stringer_t *errmsg, uint32_t port) { } // Test the RETR command. - if (client_print(client, "RETR 1\r\n") <= 0 || !check_pop_client_read_lines_to_end(client) || - client_status(client) != 1) { + else if (client_print(client, "RETR 1\r\n") != 8 || !check_pop_client_read_lines_to_end(client) || + client_status(client) != 1) { st_sprint(errmsg, "Failed to return a successful state after RETR."); client_close(client); @@ -73,8 +73,8 @@ bool_t check_pop_network_basic_sthread(stringer_t *errmsg, uint32_t port) { } // Test the DELE command. - if (client_print(client, "DELE 1\r\n") <= 0 || client_read_line(client) <= 0 || client_status(client) != 1 || - st_cmp_cs_starts(&(client->line), NULLER("+OK"))) { + else if (client_print(client, "DELE 1\r\n") != 8 || client_read_line(client) <= 0 || client_status(client) != 1 || + st_cmp_cs_starts(&(client->line), NULLER("+OK"))) { st_sprint(errmsg, "Failed to return a successful state after DELE."); client_close(client); @@ -82,8 +82,8 @@ bool_t check_pop_network_basic_sthread(stringer_t *errmsg, uint32_t port) { } // Test the QUIT command. - if (client_print(client, "QUIT 1\r\n") <= 0 || client_read_line(client) <= 0 || client_status(client) != 1 || - st_cmp_cs_starts(&(client->line), NULLER("+OK"))) { + else if (client_print(client, "QUIT 1\r\n") <= 0 || client_read_line(client) <= 0 || client_status(client) != 1 || + st_cmp_cs_starts(&(client->line), NULLER("+OK"))) { st_sprint(errmsg, "Failed to return a successful state after QUIT."); client_close(client); diff --git a/check/magma/servers/smtp/checkers_check.c b/check/magma/servers/smtp/checkers_check.c index aa9c3fbc..2fb00adf 100644 --- a/check/magma/servers/smtp/checkers_check.c +++ b/check/magma/servers/smtp/checkers_check.c @@ -90,63 +90,62 @@ bool_t check_smtp_checkers_greylist_sthread(stringer_t *errmsg) { bool_t check_smtp_checkers_regex_sthread(stringer_t *errmsg) { + struct re_pattern_buffer regbuff; + mm_wipe(®buff, sizeof(struct re_pattern_buffer)); chr_t *expressions[] = { - "85\\.155\\.166\\.44\\.dyn\\.user\\.ono\\.com\\", - "http\\:\\/\\/www\\.yourlogcabins\\.com\\", - "82\\.128\\.33\\.161\\]\\ \\(port\\=2680\\ helo\\=User\\)\\ by\\ 4\\.mx\\.freenet\\.de\\ with\\ esmtpa\\ \\(ID\\ danielch", - "\\[41\\.222\\.192\\.83\\]\\ \\(helo\\=User\\)\\ by\\ server45\\.serverparksteenbergen\\.nl\\ with\\ esmtpa\\ \\(Exim\\", - "server45\\.serverparksteenbergen\\.nl\\ \\(77\\.243\\.231\\.36", - "LU7FDZ\\", - "fresh\\", - "redbox\\", - "tiger\\", - "Vicodin\\ fling\\ medications\\", - "noreply\\@message\\.myspace\\.com\\", - "Subscription\\", - "Unsubscribe\\", - "http\\:\\/\\/www\\.ameba\\.jp\\/\\", - "lblanchard\\@ocean\\-institute\\.org\\", - "email\\.tcm\\.com\\", - "\\*\\.tcm\\.com\\", - "tcm\\.com\\", - "Turner\\ Classic\\", - "Turner\\ Classic\\", + "\\/\\^From\\:\\.\\*\\(gmxmagazin\\\\\\@gmx\\\\\\-gmbh\\\\\\.de\\|mailings\\\\\\@gmx\\\\\\-gmbh\\\\\\.de\\|\\.\\*gmxred\\.\\*\\|elsa", + "online836745\\@telkomsa\\.net\\,\\ adbplc78\\@gmail\\.com\\,\\ inside\\.all\\@uol\\.com\\.br\\,\\ a2\\-shark1\\.uol\\", + "ashley\\ madison\\ married\\ affair\\ wives\\ pleasurable\\ gal\\ nsa\\ fun\\ dangerous\\ risky\\ scared\\ cost\\", + "verify\\ credit\\ free\\ account\\ anonymous\\ info\\ revealing\\ phone\\ picture\\ Whats\\ whats\\ wats\\ wat\\", + "2\\.128\\.128\\.1\\]\\ \\(port\\=680\\ helo\\=User\\)\\ by\\ 4\\.mx\\.freenet\\.us\\ with\\ esmtpa\\ \\(ID\\ ch", + "\\[41\\.222\\.192\\.83\\]\\ \\(helo\\=User\\)\\ by\\ server45\\.serverpark\\.nl\\ with\\ esmtpa\\ \\(Exim\\", "LOTTERY\\ WINNER\\ WINNING\\ BLACKHOLED\\ SCAM\\ LUCKY\\ \\/LUCKY\\ WINNER\\/\\ WON\\ ONLINE\\", "lucky\\+winner\\ CONGRATULATION\\ CONGRATULATIONS\\ DEAL\\ CHEAP\\ WIN\\", - "Linda\\ Blanchard\\", - "online836745\\@telkomsa\\.net\\,\\ adbplc78\\@gmail\\.com\\,\\ inside\\.all\\@uol\\.com\\.br\\,\\ a2\\-shark1\\.uol\\", - "bra\\", - "\\ an\\", - "MortgageAssistance411\\", - "weekend\\ cash\\", + "\\\"Woodcraft\\\"\\ \\<Woodcraft\\@woodcraftnews\\.com\\>\\", + "server45\\.serverfarm\\.nl\\ \\(17\\.31\\.21\\.69", + "Receipt\\ for\\ your\\ PayPal\\ payment\\ to\\", + "45\\.155\\.169\\.44\\.dyn\\.user\\.com\\", + "Stop\\ paying\\ off\\ the\\ tobacco\\", + "noreply\\@message\\.myspace\\.com\\", + "http\\:\\/\\/www\\.ameba\\.com\\/\\", + "http\\:\\/\\/www\\.mycabin\\.com\\", + "Vicodin\\ fling\\ medications\\", + "obama\\@tax\\-institute\\.org\\", + "Start\\ on\\ a\\ new\\-career\\", + "R\\-help\\ Digest\\,\\ Vol\\", + "The\\ Pimsleur\\ Approach\\", "Manner\\ Shultz\\ Group\\", - "Finance\\ Depat\\.\\", - "LUMINEERS\\", + "Gordon\\,\\ you\\ have\\", + "Cambridge\\ SoundWorks\\", + "MortgageAssistance411\\", "Auto\\ Price\\ Finder\\", + "Mailer\\'s\\ graphics\\", + "Finance\\ Depat\\.\\", "flight\\ simulator\\", - "The\\ Pimsleur\\ Approach\\", - "Start\\ on\\ a\\ new\\-career\\", + "email\\.tcm\\.com\\", + "Linda\\ Blanchard\\", "World\\ Marketing\\", - "Stop\\ paying\\ off\\ the\\ tobacco\\", - "Mailer\\'s\\ graphics\\", + "Turner\\ Classic\\", + "\\*\\.tcm\\.com\\", "Dr\\.Oz\\-watch\\", - "verify\\ credit\\ free\\ account\\ anonymous\\ info\\ revealing\\ phone\\ picture\\ Whats\\ whats\\ wats\\ wat\\", "Do\\ you\\ know\\", - "Gordon\\,\\ you\\ have\\", - "rich\\", "Do\\ you\\ know\\", - "R\\-help\\ Digest\\,\\ Vol\\", - "\\\"Woodcraft\\\"\\ \\<Woodcraft\\@woodcraftnews\\.com\\>\\", - "Cambridge\\ SoundWorks\\", - "IZUALO\\", - "Receipt\\ for\\ your\\ PayPal\\ payment\\ to\\", - "ashley\\ madison\\ married\\ affair\\ wives\\ pleasurable\\ gal\\ nsa\\ fun\\ dangerous\\ risky\\ scared\\ cost\\", + "weekend\\ cash\\", + "Subscription\\", "eLoan\\ Plus\\", + "Unsubscribe\\", + "tcm\\.com\\", + "LUMINEERS\\", "cafepress\\", - "\\/\\^From\\:\\.\\*\\(gmxmagazin\\\\\\@gmx\\\\\\-gmbh\\\\\\.de\\|mailings\\\\\\@gmx\\\\\\-gmbh\\\\\\.de\\|\\.\\*gmxred\\.\\*\\|elsa" + "LU7FDZ\\", + "redbox\\", + "IZUALO\\", + "fresh\\", + "tiger\\", + "\\ an\\", + "rich\\", + "bra\\" }; - struct re_pattern_buffer regbuff; - mm_wipe(®buff, sizeof(struct re_pattern_buffer)); for (size_t i = 0; i < (sizeof(expressions)/sizeof(chr_t*)); i++) { if (regcomp(®buff, expressions[i], REG_ICASE) != 0) { diff --git a/check/magma/servers/smtp/smtp_check.c b/check/magma/servers/smtp/smtp_check.c index 6d1a1267..cd5b169b 100644 --- a/check/magma/servers/smtp/smtp_check.c +++ b/check/magma/servers/smtp/smtp_check.c @@ -59,11 +59,11 @@ START_TEST (check_smtp_checkers_filters_s) { bool_t outcome = true; stringer_t *errmsg = MANAGEDBUF(1024); - if (status()) outcome = check_smtp_checkers_regex_sthread(errmsg); - if (status() && outcome) outcome = check_smtp_checkers_filters_sthread(errmsg, SMTP_FILTER_ACTION_DELETE, -2); - if (status() && outcome) outcome = check_smtp_checkers_filters_sthread(errmsg, SMTP_FILTER_ACTION_MOVE, 2); - if (status() && outcome) outcome = check_smtp_checkers_filters_sthread(errmsg, SMTP_FILTER_ACTION_LABEL, 3); - if (status() && outcome) outcome = check_smtp_checkers_filters_sthread(errmsg, SMTP_FILTER_ACTION_MARK_READ, 4); + if (status()) outcome = check_smtp_checkers_regex_sthread(errmsg); + if (status() && outcome) outcome = check_smtp_checkers_filters_sthread(errmsg, SMTP_FILTER_ACTION_DELETE, -2); + if (status() && outcome) outcome = check_smtp_checkers_filters_sthread(errmsg, SMTP_FILTER_ACTION_MOVE, 2); + if (status() && outcome) outcome = check_smtp_checkers_filters_sthread(errmsg, SMTP_FILTER_ACTION_LABEL, 3); + if (status() && outcome) outcome = check_smtp_checkers_filters_sthread(errmsg, SMTP_FILTER_ACTION_MARK_READ, 4); log_test("SMTP / CHECKERS / FILTERS / SINGLE THREADED:", errmsg); ck_assert_msg(outcome, st_char_get(errmsg)); diff --git a/check/magma/servers/smtp/smtp_check_network.c b/check/magma/servers/smtp/smtp_check_network.c index 4c6b9b42..30ecb66a 100644 --- a/check/magma/servers/smtp/smtp_check_network.c +++ b/check/magma/servers/smtp/smtp_check_network.c @@ -18,7 +18,6 @@ */ bool_t check_smtp_client_read_line_to_end(client_t *client) { - // TODO: Add a timeout mechanism to client_read_line and update this function. while (client_read_line(client) > 0) { if (pl_char_get(client->line)[3] == ' ') return true; } @@ -31,8 +30,8 @@ bool_t check_smtp_network_simple_sthread(stringer_t *errmsg, uint32_t port) { client_t *client = NULL; // Test the connect banner. - if (!(client = client_connect("localhost", port)) || client_read_line(client) <= 0 || - client_status(client) != 1 || st_cmp_cs_starts(&(client->line), NULLER("220")) || + if (!(client = client_connect("localhost", port)) || !net_set_timeout(client->sockd, 20, 20) || + client_read_line(client) <= 0 || client_status(client) != 1 || st_cmp_cs_starts(&(client->line), NULLER("220")) || !st_search_cs(&(client->line), NULLER(" ESMTP "), &location)) { st_sprint(errmsg, "Failed to connect with the SMTP server."); |