Add an option WITH_LIBZ to compile with zlib support.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@289 7dcaeef0-15fb-0310-b436-a5af3365683c
Этот коммит содержится в:
родитель
d3d7f08d6a
Коммит
33b948cab9
@ -49,6 +49,11 @@ if (Z_LIBRARY)
|
|||||||
set(HAVE_LIBZ 1)
|
set(HAVE_LIBZ 1)
|
||||||
endif (Z_LIBRARY)
|
endif (Z_LIBRARY)
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
if (WITH_LIBZ)
|
||||||
|
set(WITH_LIBZ 1)
|
||||||
|
endif (WITH_LIBZ)
|
||||||
|
|
||||||
if (WITH_SSH1)
|
if (WITH_SSH1)
|
||||||
set(HAVE_SSH1 1)
|
set(HAVE_SSH1 1)
|
||||||
endif (WITH_SSH1)
|
endif (WITH_SSH1)
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
|
option(WITH_LIBZ "Build with ZLIB support" ON)
|
||||||
option(WITH_SSH1 "Build with SSH1 support" OFF)
|
option(WITH_SSH1 "Build with SSH1 support" OFF)
|
||||||
option(WITH_STATIC_LIB "Build with a static library" OFF)
|
option(WITH_STATIC_LIB "Build with a static library" OFF)
|
||||||
|
@ -59,8 +59,11 @@
|
|||||||
|
|
||||||
/**************************** OPTIONS ****************************/
|
/**************************** OPTIONS ****************************/
|
||||||
|
|
||||||
|
/* Define to 1 if you want to enable ZLIB */
|
||||||
|
#cmakedefine WITH_LIBZ 1
|
||||||
|
|
||||||
/* Define to 1 if you want to enable SSH1 */
|
/* Define to 1 if you want to enable SSH1 */
|
||||||
#cmakedefine HAVE_SSH1
|
#cmakedefine HAVE_SSH1 1
|
||||||
|
|
||||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||||
|
@ -19,17 +19,16 @@ You should have received a copy of the GNU Lesser General Public License
|
|||||||
along with the SSH Library; see the file COPYING. If not, write to
|
along with the SSH Library; see the file COPYING. If not, write to
|
||||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
MA 02111-1307, USA. */
|
MA 02111-1307, USA. */
|
||||||
#include "libssh/priv.h"
|
|
||||||
#ifdef HAVE_LIBZ
|
|
||||||
#undef NO_GZIP
|
|
||||||
#else
|
|
||||||
#define NO_GZIP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NO_GZIP
|
#include "config.h"
|
||||||
|
#include "libssh/priv.h"
|
||||||
|
|
||||||
|
#if defined(HAVE_LIBZ) && defined(WITH_LIBZ)
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define BLOCKSIZE 4092
|
#define BLOCKSIZE 4092
|
||||||
|
|
||||||
static z_stream *initcompress(SSH_SESSION *session,int level){
|
static z_stream *initcompress(SSH_SESSION *session,int level){
|
||||||
@ -42,7 +41,7 @@ static z_stream *initcompress(SSH_SESSION *session,int level){
|
|||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
BUFFER *gzip_compress(SSH_SESSION *session,BUFFER *source,int level){
|
static BUFFER *gzip_compress(SSH_SESSION *session,BUFFER *source,int level){
|
||||||
BUFFER *dest;
|
BUFFER *dest;
|
||||||
static unsigned char out_buf[BLOCKSIZE];
|
static unsigned char out_buf[BLOCKSIZE];
|
||||||
void *in_ptr=buffer_get(source);
|
void *in_ptr=buffer_get(source);
|
||||||
@ -96,7 +95,7 @@ static z_stream *initdecompress(SSH_SESSION *session){
|
|||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
BUFFER *gzip_decompress(SSH_SESSION *session,BUFFER *source){
|
static BUFFER *gzip_decompress(SSH_SESSION *session,BUFFER *source){
|
||||||
BUFFER *dest;
|
BUFFER *dest;
|
||||||
static unsigned char out_buf[BLOCKSIZE];
|
static unsigned char out_buf[BLOCKSIZE];
|
||||||
void *in_ptr=buffer_get_rest(source);
|
void *in_ptr=buffer_get_rest(source);
|
||||||
@ -138,4 +137,5 @@ int decompress_buffer(SSH_SESSION *session,BUFFER *buf){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* NO_GZIP */
|
#endif /* HAVE_LIBZ && WITH_LIBZ */
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@ MA 02111-1307, USA. */
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "libssh/priv.h"
|
#include "libssh/priv.h"
|
||||||
#include "libssh/ssh2.h"
|
#include "libssh/ssh2.h"
|
||||||
#include "libssh/ssh1.h"
|
#include "libssh/ssh1.h"
|
||||||
@ -44,7 +46,7 @@ MA 02111-1307, USA. */
|
|||||||
#define DES "3des-cbc"
|
#define DES "3des-cbc"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBZ
|
#if defined(HAVE_LIBZ) && defined(WITH_LIBZ)
|
||||||
#define ZLIB "none,zlib"
|
#define ZLIB "none,zlib"
|
||||||
#else
|
#else
|
||||||
#define ZLIB "none"
|
#define ZLIB "none"
|
||||||
|
@ -29,6 +29,8 @@ MA 02111-1307, USA. */
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define _WIN32_IE 0x0400 //SHGetSpecialFolderPath
|
#define _WIN32_IE 0x0400 //SHGetSpecialFolderPath
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
@ -39,6 +41,24 @@ MA 02111-1307, USA. */
|
|||||||
|
|
||||||
#include "libssh/priv.h"
|
#include "libssh/priv.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBGCRYPT
|
||||||
|
#define GCRYPT_STRING "/gnutls"
|
||||||
|
#else
|
||||||
|
#define GCRYPT_STRING ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBCRYPTO
|
||||||
|
#define CRYPTO_STRING "/openssl"
|
||||||
|
#else
|
||||||
|
#define CRYPTO_STRING ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_LIBZ) && defined(WITH_LIBZ)
|
||||||
|
#define LIBZ_STRING "/zlib"
|
||||||
|
#else
|
||||||
|
#define LIBZ_STRING ""
|
||||||
|
#endif
|
||||||
|
|
||||||
/** \defgroup ssh_misc SSH Misc
|
/** \defgroup ssh_misc SSH Misc
|
||||||
* \brief Misc functions
|
* \brief Misc functions
|
||||||
*/
|
*/
|
||||||
@ -116,13 +136,8 @@ u64 ntohll(u64 a){
|
|||||||
*/
|
*/
|
||||||
const char *ssh_version(int req_version) {
|
const char *ssh_version(int req_version) {
|
||||||
if (req_version <= LIBSSH_VERSION_INT) {
|
if (req_version <= LIBSSH_VERSION_INT) {
|
||||||
#ifdef HAVE_LIBGCRYPT
|
return SSH_STRINGIFY(LIBSSH_VERSION) GCRYPT_STRING CRYPTO_STRING
|
||||||
return SSH_STRINGIFY(LIBSSH_VERSION) "/gnutls/zlib";
|
LIBZ_STRING;
|
||||||
#elif defined HAVE_LIBCRYPTO
|
|
||||||
return SSH_STRINGIFY(LIBSSH_VERSION) "/openssl/zlib";
|
|
||||||
#else
|
|
||||||
return SSH_STRINGIFY(LIBSSH_VERSION);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -24,10 +24,12 @@ MA 02111-1307, USA. */
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "libssh/priv.h"
|
#include "libssh/priv.h"
|
||||||
#include "libssh/ssh2.h"
|
#include "libssh/ssh2.h"
|
||||||
#include "libssh/ssh1.h"
|
#include "libssh/ssh1.h"
|
||||||
#include <errno.h>
|
|
||||||
#include "libssh/crypto.h"
|
#include "libssh/crypto.h"
|
||||||
|
|
||||||
/* XXX include selected mac size */
|
/* XXX include selected mac size */
|
||||||
@ -139,7 +141,7 @@ static int packet_read2(SSH_SESSION *session){
|
|||||||
ssh_log(session, SSH_LOG_RARE,
|
ssh_log(session, SSH_LOG_RARE,
|
||||||
"After padding, %d bytes left in buffer",
|
"After padding, %d bytes left in buffer",
|
||||||
buffer_get_rest_len(session->in_buffer));
|
buffer_get_rest_len(session->in_buffer));
|
||||||
#ifdef HAVE_LIBZ
|
#if defined(HAVE_LIBZ) && defined(WITH_LIBZ)
|
||||||
if(session->current_crypto && session->current_crypto->do_compress_in){
|
if(session->current_crypto && session->current_crypto->do_compress_in){
|
||||||
ssh_log(session, SSH_LOG_RARE, "Decompressing in_buffer ...");
|
ssh_log(session, SSH_LOG_RARE, "Decompressing in_buffer ...");
|
||||||
decompress_buffer(session,session->in_buffer);
|
decompress_buffer(session,session->in_buffer);
|
||||||
@ -247,7 +249,7 @@ static int packet_read1(SSH_SESSION *session){
|
|||||||
buffer_pass_bytes(session->in_buffer,padding); /*pass the padding*/
|
buffer_pass_bytes(session->in_buffer,padding); /*pass the padding*/
|
||||||
ssh_log(session,SSH_LOG_PACKET,"the packet is valid");
|
ssh_log(session,SSH_LOG_PACKET,"the packet is valid");
|
||||||
/* will do that later
|
/* will do that later
|
||||||
#ifdef HAVE_LIBZ
|
#if defined(HAVE_LIBZ) && defined(WITH_LIBZ)
|
||||||
if(session->current_crypto && session->current_crypto->do_compress_in){
|
if(session->current_crypto && session->current_crypto->do_compress_in){
|
||||||
decompress_buffer(session,session->in_buffer);
|
decompress_buffer(session,session->in_buffer);
|
||||||
}
|
}
|
||||||
@ -326,7 +328,7 @@ static int packet_send2(SSH_SESSION *session){
|
|||||||
enter_function();
|
enter_function();
|
||||||
ssh_log(session, SSH_LOG_RARE,
|
ssh_log(session, SSH_LOG_RARE,
|
||||||
"Writing on the wire a packet having %u bytes before", currentlen);
|
"Writing on the wire a packet having %u bytes before", currentlen);
|
||||||
#ifdef HAVE_LIBZ
|
#if defined(HAVE_LIBZ) && defined(WITH_LIBZ)
|
||||||
if(session->current_crypto && session->current_crypto->do_compress_out){
|
if(session->current_crypto && session->current_crypto->do_compress_out){
|
||||||
ssh_log(session, SSH_LOG_RARE, "Compressing in_buffer ...");
|
ssh_log(session, SSH_LOG_RARE, "Compressing in_buffer ...");
|
||||||
compress_buffer(session,session->out_buffer);
|
compress_buffer(session,session->out_buffer);
|
||||||
@ -369,7 +371,7 @@ static int packet_send1(SSH_SESSION *session){
|
|||||||
enter_function();
|
enter_function();
|
||||||
ssh_log(session,SSH_LOG_PACKET,"Sending a %d bytes long packet",currentlen);
|
ssh_log(session,SSH_LOG_PACKET,"Sending a %d bytes long packet",currentlen);
|
||||||
/*
|
/*
|
||||||
#ifdef HAVE_LIBZ
|
#if defined(HAVE_LIBZ) && defined(WITH_LIBZ)
|
||||||
if(session->current_crypto && session->current_crypto->do_compress_out){
|
if(session->current_crypto && session->current_crypto->do_compress_out){
|
||||||
compress_buffer(session,session->out_buffer);
|
compress_buffer(session,session->out_buffer);
|
||||||
currentlen=buffer_get_len(session->out_buffer);
|
currentlen=buffer_get_len(session->out_buffer);
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user