build: Fix zlib support.
Этот коммит содержится в:
родитель
43fc7553f8
Коммит
6859e4f4ec
2
INSTALL
2
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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user