From 6859e4f4ecf6aae135dc54ea2ec74f9405a78360 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 23 Sep 2011 22:54:33 +0200 Subject: [PATCH] build: Fix zlib support. --- INSTALL | 2 +- config.h.cmake | 2 +- src/kex.c | 2 +- src/misc.c | 8 ++++---- src/packet.c | 8 ++++---- src/packet1.c | 4 ++-- src/wrapper.c | 6 +++--- tests/client/torture_algorithms.c | 12 ++++++------ 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/INSTALL b/INSTALL index 97f40cd8..66c36f0e 100644 --- a/INSTALL +++ b/INSTALL @@ -47,7 +47,7 @@ Options are defined in the following files: They can be changed with the -D option: -`cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DWITH_LIBZ=OFF ..` +`cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DWITH_ZLIB=OFF ..` ### Browsing/editing CMake options diff --git a/config.h.cmake b/config.h.cmake index 5c88f4f0..334e8459 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -105,7 +105,7 @@ /**************************** OPTIONS ****************************/ /* Define to 1 if you want to enable ZLIB */ -#cmakedefine WITH_LIBZ 1 +#cmakedefine WITH_ZLIB 1 /* Define to 1 if you want to enable SFTP */ #cmakedefine WITH_SFTP 1 diff --git a/src/kex.c b/src/kex.c index 438f398f..096d7a07 100644 --- a/src/kex.c +++ b/src/kex.c @@ -58,7 +58,7 @@ #define DES "3des-cbc" #endif -#ifdef WITH_LIBZ +#ifdef WITH_ZLIB #define ZLIB "none,zlib,zlib@openssh.com" #else #define ZLIB "none" diff --git a/src/misc.c b/src/misc.c index b128e5ea..6d3ccde1 100644 --- a/src/misc.c +++ b/src/misc.c @@ -80,10 +80,10 @@ #define CRYPTO_STRING "" #endif -#ifdef WITH_LIBZ -#define LIBZ_STRING "/zlib" +#ifdef WITH_ZLIB +#define ZLIB_STRING "/zlib" #else -#define LIBZ_STRING "" +#define ZLIB_STRING "" #endif /** @@ -357,7 +357,7 @@ char *ssh_hostport(const char *host, int port){ const char *ssh_version(int req_version) { if (req_version <= LIBSSH_VERSION_INT) { return SSH_STRINGIFY(LIBSSH_VERSION) GCRYPT_STRING CRYPTO_STRING - LIBZ_STRING; + ZLIB_STRING; } return NULL; diff --git a/src/packet.c b/src/packet.c index 33b284a2..fe79874f 100644 --- a/src/packet.c +++ b/src/packet.c @@ -255,7 +255,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user) ssh_log(session, SSH_LOG_PACKET, "After padding, %d bytes left in buffer", buffer_get_rest_len(session->in_buffer)); -#ifdef WITH_LIBZ +#ifdef WITH_ZLIB if (session->current_crypto && session->current_crypto->do_compress_in && buffer_get_rest_len(session->in_buffer)) { @@ -264,7 +264,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user) goto error; } } -#endif +#endif /* WITH_ZLIB */ session->recv_seq++; /* We don't want to rewrite a new packet while still executing the packet callbacks */ session->packet_state = PACKET_STATE_PROCESSING; @@ -460,7 +460,7 @@ static int packet_send2(ssh_session session) { ssh_log(session, SSH_LOG_PACKET, "Writing on the wire a packet having %u bytes before", currentlen); -#ifdef WITH_LIBZ +#ifdef WITH_ZLIB if (session->current_crypto && session->current_crypto->do_compress_out && buffer_get_rest_len(session->out_buffer)) { @@ -470,7 +470,7 @@ static int packet_send2(ssh_session session) { } currentlen = buffer_get_rest_len(session->out_buffer); } -#endif +#endif /* WITH_ZLIB */ padding = (blocksize - ((currentlen +5) % blocksize)); if(padding < 4) { padding += blocksize; diff --git a/src/packet1.c b/src/packet1.c index a0a36f8e..894aedd7 100644 --- a/src/packet1.c +++ b/src/packet1.c @@ -214,7 +214,7 @@ int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user ssh_log(session, SSH_LOG_PACKET, "The packet is valid"); /* TODO FIXME -#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) +#ifdef WITH_ZLIB if(session->current_crypto && session->current_crypto->do_compress_in){ decompress_buffer(session,session->in_buffer); } @@ -264,7 +264,7 @@ int packet_send1(ssh_session session) { ssh_log(session,SSH_LOG_PACKET,"Sending a %d bytes long packet",currentlen); /* TODO FIXME -#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) +#ifdef WITH_ZLIB if (session->current_crypto && session->current_crypto->do_compress_out) { if (compress_buffer(session, session->out_buffer) < 0) { goto error; diff --git a/src/wrapper.c b/src/wrapper.c index 3a917200..edce03d4 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -38,7 +38,7 @@ #include #include -#ifdef WITH_LIBZ +#ifdef WITH_ZLIB #include #endif @@ -122,7 +122,7 @@ void crypto_free(struct ssh_crypto_struct *crypto){ SAFE_FREE(crypto->session_id); } -#ifdef WITH_LIBZ +#ifdef WITH_ZLIB if (crypto->compress_out_ctx && (deflateEnd(crypto->compress_out_ctx) != 0)) { inflateEnd(crypto->compress_out_ctx); @@ -131,7 +131,7 @@ void crypto_free(struct ssh_crypto_struct *crypto){ (deflateEnd(crypto->compress_in_ctx) != 0)) { inflateEnd(crypto->compress_in_ctx); } -#endif +#endif /* WITH_ZLIB */ if(crypto->encryptIV) SAFE_FREE(crypto->encryptIV); if(crypto->decryptIV) diff --git a/tests/client/torture_algorithms.c b/tests/client/torture_algorithms.c index 209d5556..3f090a29 100644 --- a/tests/client/torture_algorithms.c +++ b/tests/client/torture_algorithms.c @@ -101,21 +101,21 @@ static void torture_algorithms_zlib(void **state) { assert_true(rc == SSH_OK); rc = ssh_options_set(session, SSH_OPTIONS_COMPRESSION_C_S, "zlib"); -#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) +#ifdef WITH_ZLIB assert_true(rc == SSH_OK); #else assert_true(rc == SSH_ERROR); #endif rc = ssh_options_set(session, SSH_OPTIONS_COMPRESSION_S_C, "zlib"); -#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) +#ifdef WITH_ZLIB assert_true(rc == SSH_OK); #else assert_true(rc == SSH_ERROR); #endif rc = ssh_connect(session); -#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) +#ifdef WITH_ZLIB if (ssh_get_openssh_version(session)) { assert_false(rc == SSH_OK); ssh_disconnect(session); @@ -141,21 +141,21 @@ static void torture_algorithms_zlib_openssh(void **state) { assert_true(rc == SSH_OK); rc = ssh_options_set(session, SSH_OPTIONS_COMPRESSION_C_S, "zlib@openssh.com"); -#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) +#ifdef WITH_ZLIB assert_true(rc == SSH_OK); #else assert_true(rc == SSH_ERROR); #endif rc = ssh_options_set(session, SSH_OPTIONS_COMPRESSION_S_C, "zlib@openssh.com"); -#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) +#ifdef WITH_ZLIB assert_true(rc == SSH_OK); #else assert_true(rc == SSH_ERROR); #endif rc = ssh_connect(session); -#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) +#ifdef WITH_ZLIB if (ssh_get_openssh_version(session)) { assert_true(rc==SSH_OK); rc = ssh_userauth_none(session, NULL);