Skip to content

Commit e4ed079

Browse files
committed
session BUILD libssh threads for v0.8.0 and higher
Fixes #168
1 parent a572d2b commit e4ed079

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/session.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,17 +1360,24 @@ nc_handshake_io(struct nc_session *session)
13601360
static void
13611361
nc_ssh_init(void)
13621362
{
1363+
#if (LIBSSH_VERSION_INT < SSH_VERSION_INT(0, 8, 0))
13631364
ssh_threads_set_callbacks(ssh_threads_get_pthread());
13641365
ssh_init();
1366+
#endif
13651367
}
13661368

13671369
static void
13681370
nc_ssh_destroy(void)
13691371
{
1372+
#if OPENSSL_VERSION_NUMBER < 0x10100000L // < 1.1.0
13701373
FIPS_mode_set(0);
13711374
CONF_modules_unload(1);
13721375
nc_thread_destroy();
1376+
#endif
1377+
1378+
#if (LIBSSH_VERSION_INT < SSH_VERSION_INT(0, 8, 0))
13731379
ssh_finalize();
1380+
#endif
13741381
}
13751382

13761383
#endif /* NC_ENABLED_SSH */
@@ -1511,9 +1518,11 @@ nc_ssh_tls_init(void)
15111518
SSL_load_error_strings();
15121519
ERR_load_BIO_strings();
15131520
SSL_library_init();
1521+
#endif
15141522

15151523
nc_ssh_init();
15161524

1525+
#if OPENSSL_VERSION_NUMBER < 0x10100000L // < 1.1.0
15171526
CRYPTO_set_dynlock_create_callback(tls_dyn_create_func);
15181527
CRYPTO_set_dynlock_lock_callback(tls_dyn_lock_func);
15191528
CRYPTO_set_dynlock_destroy_callback(tls_dyn_destroy_func);
@@ -1525,14 +1534,16 @@ nc_ssh_tls_destroy(void)
15251534
{
15261535
#if OPENSSL_VERSION_NUMBER < 0x10100000L // < 1.1.0
15271536
ERR_free_strings();
1528-
#if OPENSSL_VERSION_NUMBER < 0x10002000L // < 1.0.2
1537+
# if OPENSSL_VERSION_NUMBER < 0x10002000L // < 1.0.2
15291538
sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
1530-
#elif OPENSSL_VERSION_NUMBER < 0x10100000L // < 1.1.0
1539+
# elif OPENSSL_VERSION_NUMBER < 0x10100000L // < 1.1.0
15311540
SSL_COMP_free_compression_methods();
1541+
# endif
15321542
#endif
15331543

15341544
nc_ssh_destroy();
15351545

1546+
#if OPENSSL_VERSION_NUMBER < 0x10100000L // < 1.1.0
15361547
CRYPTO_set_dynlock_create_callback(NULL);
15371548
CRYPTO_set_dynlock_lock_callback(NULL);
15381549
CRYPTO_set_dynlock_destroy_callback(NULL);

0 commit comments

Comments
 (0)