Make haiku compile again, though I'm not happy about its lack of INADDR_ANY support.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4759 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2024-01-12 00:11:03 +00:00
parent 59ac0b5f20
commit 4fd155e68a
2 changed files with 9 additions and 1 deletions

View File

@ -1797,7 +1797,7 @@ JSValue tf_ssb_sign_message(tf_ssb_t* ssb, const char* author, const uint8_t* pr
static void _tf_ssb_connection_dispatch_scheduled(tf_ssb_connection_t* connection) static void _tf_ssb_connection_dispatch_scheduled(tf_ssb_connection_t* connection)
{ {
const int k_scheduled_batch_count = 8; const int k_scheduled_batch_count = 8;
for (int i = 0; i < k_scheduled_batch_count && connection->scheduled_count; i++) for (int i = 0; i < k_scheduled_batch_count && connection->scheduled_count && connection->scheduled; i++)
{ {
tf_ssb_connection_scheduled_t scheduled = connection->scheduled[0]; tf_ssb_connection_scheduled_t scheduled = connection->scheduled[0];
memmove(connection->scheduled, connection->scheduled + 1, sizeof(tf_ssb_connection_scheduled_t) * (connection->scheduled_count - 1)); memmove(connection->scheduled, connection->scheduled + 1, sizeof(tf_ssb_connection_scheduled_t) * (connection->scheduled_count - 1));

View File

@ -165,7 +165,11 @@ void tf_tls_session_shutdown(tf_tls_session_t* session)
int tf_tls_session_get_peer_certificate(tf_tls_session_t* session, char* buffer, size_t bytes) int tf_tls_session_get_peer_certificate(tf_tls_session_t* session, char* buffer, size_t bytes)
{ {
int result = -1; int result = -1;
#if OPENSSL_VERSION_NUMBER < 0x30000000L
X509* certificate = SSL_get_peer_certificate(session->ssl);
#else
X509* certificate = SSL_get1_peer_certificate(session->ssl); X509* certificate = SSL_get1_peer_certificate(session->ssl);
#endif
BIO* bio = BIO_new(BIO_s_mem()); BIO* bio = BIO_new(BIO_s_mem());
PEM_write_bio_X509(bio, certificate); PEM_write_bio_X509(bio, certificate);
X509_free(certificate); X509_free(certificate);
@ -269,7 +273,11 @@ static bool _tls_session_verify_hostname(X509* certificate, const char* hostname
static bool _tls_session_verify_peer_certificate(tf_tls_session_t* session) static bool _tls_session_verify_peer_certificate(tf_tls_session_t* session)
{ {
bool verified = false; bool verified = false;
#if OPENSSL_VERSION_NUMBER < 0x30000000L
X509* certificate = SSL_get_peer_certificate(session->ssl);
#else
X509* certificate = SSL_get1_peer_certificate(session->ssl); X509* certificate = SSL_get1_peer_certificate(session->ssl);
#endif
if (certificate) if (certificate)
{ {
if (SSL_get_verify_result(session->ssl) == X509_V_OK) if (SSL_get_verify_result(session->ssl) == X509_V_OK)