Skip to content

Commit 57646a8

Browse files
committed
check if clientfd != SOCKET_INVALID not 0, add check if USE_WINDOWS_API
not defined
1 parent d37e566 commit 57646a8

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

scripts/ocsp-stapling.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ generate_port() {
452452
port=$(($(od -An -N2 /dev/urandom) % (65535-49512) + 49512))
453453
elif [[ "$OSTYPE" == "darwin"* ]]; then
454454
port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512))
455+
elif [[ "$OSTYPE" == "msys" ]]; then
456+
port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512))
455457
else
456458
echo "Unknown OS TYPE"
457459
exit 1

tests/api.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8237,7 +8237,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args)
82378237
if (!sharedCtx)
82388238
wolfSSL_CTX_free(ctx);
82398239

8240-
if (clientfd >= 0)
8240+
if (clientfd != SOCKET_INVALID)
82418241
CloseSocket(clientfd);
82428242

82438243
#ifdef WOLFSSL_TIRTOS
@@ -69604,7 +69604,7 @@ static int test_wolfSSL_TXT_DB(void)
6960469604

6960569605
/* Test index */
6960669606
ExpectIntEQ(TXT_DB_create_index(db, 3, NULL,
69607-
(wolf_sk_hash_cb)(long unsigned int)TXT_DB_hash,
69607+
(wolf_sk_hash_cb)(MESSAGE_TYPE_CAST)TXT_DB_hash,
6960869608
(wolf_lh_compare_cb)TXT_DB_cmp), 1);
6960969609
ExpectNotNull(TXT_DB_get_by_index(db, 3, (WOLFSSL_STRING*)fields));
6961069610
fields[3] = "12DA";
@@ -83752,10 +83752,10 @@ static void test_wolfSSL_dtls_plaintext_client(WOLFSSL* ssl)
8375283752
AssertIntGE(fd, 0);
8375383753
generateDTLSMsg(ch, sizeof(ch), 20, client_hello, 0);
8375483754
/* Server should ignore this datagram */
83755-
AssertIntEQ(send(fd, ch, sizeof(ch), 0), sizeof(ch));
83755+
AssertIntEQ(send(fd, (MESSAGE_TYPE_CAST)ch, sizeof(ch), 0), sizeof(ch));
8375683756
generateDTLSMsg(ch, sizeof(ch), 20, client_hello, 10000);
8375783757
/* Server should ignore this datagram */
83758-
AssertIntEQ(send(fd, ch, sizeof(ch), 0), sizeof(ch));
83758+
AssertIntEQ(send(fd, (MESSAGE_TYPE_CAST)ch, sizeof(ch), 0), sizeof(ch));
8375983759

8376083760
AssertIntEQ(wolfSSL_write(ssl, msg, sizeof(msg)), sizeof(msg));
8376183761
AssertIntGT(wolfSSL_read(ssl, reply, sizeof(reply)),0);
@@ -83866,7 +83866,7 @@ static void test_wolfSSL_dtls12_fragments_spammer(WOLFSSL* ssl)
8386683866
delay.tv_nsec = 10000000; /* wait 0.01 seconds */
8386783867
c32toa(seq_number, b + seq_offset);
8386883868
c16toa(msg_number, b + msg_offset);
83869-
ret = (int)send(fd, b, 55, 0);
83869+
ret = (int)send(fd, (MESSAGE_TYPE_CAST)b, 55, 0);
8387083870
nanosleep(&delay, NULL);
8387183871
}
8387283872
}
@@ -83986,7 +83986,7 @@ static void test_wolfSSL_dtls_send_alert(WOLFSSL* ssl)
8398683986

8398783987
fd = wolfSSL_get_wfd(ssl);
8398883988
AssertIntGE(fd, 0);
83989-
ret = (int)send(fd, alert_msg, sizeof(alert_msg), 0);
83989+
ret = (int)send(fd, (MESSAGE_TYPE_CAST)alert_msg, sizeof(alert_msg), 0);
8399083990
AssertIntGT(ret, 0);
8399183991
}
8399283992

@@ -84057,7 +84057,7 @@ static void test_wolfSSL_send_bad_record(WOLFSSL* ssl)
8405784057

8405884058
fd = wolfSSL_get_wfd(ssl);
8405984059
AssertIntGE(fd, 0);
84060-
ret = (int)send(fd, bad_msg, sizeof(bad_msg), 0);
84060+
ret = (int)send(fd, (MESSAGE_TYPE_CAST)bad_msg, sizeof(bad_msg), 0);
8406184061
AssertIntEQ(ret, sizeof(bad_msg));
8406284062
ret = wolfSSL_write(ssl, "badrecordtest", sizeof("badrecordtest"));
8406384063
AssertIntEQ(ret, sizeof("badrecordtest"));
@@ -84415,10 +84415,10 @@ static void test_wolfSSL_dtls_send_ch(WOLFSSL* ssl)
8441584415

8441684416
fd = wolfSSL_get_wfd(ssl);
8441784417
AssertIntGE(fd, 0);
84418-
ret = (int)send(fd, ch_msg, sizeof(ch_msg), 0);
84418+
ret = (int)send(fd, (MESSAGE_TYPE_CAST)ch_msg, sizeof(ch_msg), 0);
8441984419
AssertIntGT(ret, 0);
8442084420
/* consume the HRR otherwise handshake will fail */
84421-
ret = (int)recv(fd, ch_msg, sizeof(ch_msg), 0);
84421+
ret = (int)recv(fd, (MESSAGE_TYPE_CAST)ch_msg, sizeof(ch_msg), 0);
8442284422
AssertIntGT(ret, 0);
8442384423
}
8442484424

@@ -91064,7 +91064,8 @@ static int test_dtls_msg_from_other_peer(void)
9106491064
* !defined(SINGLE_THREADED) && !defined(NO_RSA) */
9106591065
#if defined(WOLFSSL_DTLS) && !defined(WOLFSSL_IPV6) && \
9106691066
!defined(NO_WOLFSSL_CLIENT) && !defined(NO_WOLFSSL_SERVER) && \
91067-
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(WOLFSSL_NO_TLS12)
91067+
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(WOLFSSL_NO_TLS12) \
91068+
&& !defined(USE_WINDOWS_API)
9106891069
static int test_dtls_ipv6_check(void)
9106991070
{
9107091071
EXPECT_DECLS;

0 commit comments

Comments
 (0)