aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-09-23 22:54:33 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2011-09-23 22:57:21 +0200
commit6859e4f4ecf6aae135dc54ea2ec74f9405a78360 (patch)
treebe9901e69feb47d304ce3697bc110dd55c8a032f
parent43fc7553f898c03bf95ac9fc0a2294e319ededa4 (diff)
downloadlibssh-6859e4f4ecf6aae135dc54ea2ec74f9405a78360.tar.gz
libssh-6859e4f4ecf6aae135dc54ea2ec74f9405a78360.tar.xz
libssh-6859e4f4ecf6aae135dc54ea2ec74f9405a78360.zip
build: Fix zlib support.
-rw-r--r--INSTALL2
-rw-r--r--config.h.cmake2
-rw-r--r--src/kex.c2
-rw-r--r--src/misc.c8
-rw-r--r--src/packet.c8
-rw-r--r--src/packet1.c4
-rw-r--r--src/wrapper.c6
-rw-r--r--tests/client/torture_algorithms.c12
8 files changed, 22 insertions, 22 deletions
diff --git a/INSTALL b/INSTALL
index 97f40cd..66c36f0 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 5c88f4f..334e845 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 438f398..096d7a0 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 b128e5e..6d3ccde 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 33b284a..fe79874 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 a0a36f8..894aedd 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 3a91720..edce03d 100644
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -38,7 +38,7 @@
#include <stdio.h>
#include <string.h>
-#ifdef WITH_LIBZ
+#ifdef WITH_ZLIB
#include <zlib.h>
#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 209d555..3f090a2 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);