forked from osmocom/wireshark
Fix for bug 2875:
Fix a final eth_fopen -> ws_fopen When configuring with --without-zlib these functions need to have some parameters tagged _U_ svn path=/trunk/; revision=26212
This commit is contained in:
parent
740a53095c
commit
b95f7e92ae
|
@ -1185,6 +1185,7 @@ ssl_create_flow(void)
|
||||||
return flow;
|
return flow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBZ
|
||||||
/* memory allocations functions for zlib intialization */
|
/* memory allocations functions for zlib intialization */
|
||||||
static void* ssl_zalloc(void* opaque _U_, unsigned int no, unsigned int size)
|
static void* ssl_zalloc(void* opaque _U_, unsigned int no, unsigned int size)
|
||||||
{
|
{
|
||||||
|
@ -1194,6 +1195,7 @@ static void ssl_zfree(void* opaque _U_, void* address)
|
||||||
{
|
{
|
||||||
g_free(address);
|
g_free(address);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static SslDecompress*
|
static SslDecompress*
|
||||||
ssl_create_decompressor(gint compression)
|
ssl_create_decompressor(gint compression)
|
||||||
|
@ -1713,16 +1715,13 @@ dtls_check_mac(SslDecoder*decoder, gint ct,int ver, guint8* data,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBZ
|
||||||
int
|
int
|
||||||
ssl_decompress_record(SslDecompress* decomp, const guchar* in, guint inl, StringInfo* out_str, guint* outl)
|
ssl_decompress_record(SslDecompress* decomp, const guchar* in, guint inl, StringInfo* out_str, guint* outl)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBZ
|
|
||||||
gint err;
|
gint err;
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (decomp->compression) {
|
switch (decomp->compression) {
|
||||||
#ifdef HAVE_LIBZ
|
|
||||||
case 1: /* DEFLATE */
|
case 1: /* DEFLATE */
|
||||||
err = Z_OK;
|
err = Z_OK;
|
||||||
if (out_str->data_len < 16384) { /* maximal plain length */
|
if (out_str->data_len < 16384) { /* maximal plain length */
|
||||||
|
@ -1740,13 +1739,20 @@ ssl_decompress_record(SslDecompress* decomp, const guchar* in, guint inl, String
|
||||||
}
|
}
|
||||||
*outl = out_str->data_len - decomp->istream.avail_out;
|
*outl = out_str->data_len - decomp->istream.avail_out;
|
||||||
break;
|
break;
|
||||||
#endif /* HAVE_LIBZ */
|
|
||||||
default:
|
default:
|
||||||
ssl_debug_printf("ssl_decompress_record: unsupported compression method %d\n", decomp->compression);
|
ssl_debug_printf("ssl_decompress_record: unsupported compression method %d\n", decomp->compression);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int
|
||||||
|
ssl_decompress_record(SslDecompress* decomp _U_, const guchar* in _U_, guint inl _U_, StringInfo* out_str _U_, guint* outl _U_)
|
||||||
|
{
|
||||||
|
ssl_debug_printf("ssl_decompress_record: unsupported compression method %d\n", decomp->compression);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
ssl_decrypt_record(SslDecryptSession*ssl,SslDecoder* decoder, gint ct,
|
ssl_decrypt_record(SslDecryptSession*ssl,SslDecoder* decoder, gint ct,
|
||||||
|
|
|
@ -1503,10 +1503,15 @@ vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
|
||||||
return 0; /* bytes_needed */
|
return 0; /* bytes_needed */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBZ
|
||||||
static guint
|
static guint
|
||||||
vnc_zrle_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
|
vnc_zrle_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
|
||||||
proto_tree *tree, guint16 width, guint16 height)
|
proto_tree *tree, guint16 width, guint16 height)
|
||||||
|
#else
|
||||||
|
static guint
|
||||||
|
vnc_zrle_encoding(tvbuff_t *tvb, packet_info *pinfo _U_, gint *offset,
|
||||||
|
proto_tree *tree, guint16 width _U_, guint16 height _U_)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
guint32 data_len;
|
guint32 data_len;
|
||||||
#ifdef HAVE_LIBZ
|
#ifdef HAVE_LIBZ
|
||||||
|
|
|
@ -688,18 +688,21 @@ gboolean wtap_dump_can_write_encap(int filetype, int encap)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBZ
|
||||||
gboolean wtap_dump_can_compress(int filetype)
|
gboolean wtap_dump_can_compress(int filetype)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBZ
|
|
||||||
if (filetype < 0 || filetype >= wtap_num_file_types
|
if (filetype < 0 || filetype >= wtap_num_file_types
|
||||||
|| dump_open_table[filetype].can_compress == FALSE)
|
|| dump_open_table[filetype].can_compress == FALSE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#else
|
|
||||||
return FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
gboolean wtap_dump_can_compress(int filetype _U_)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static gboolean wtap_dump_open_check(int filetype, int encap, gboolean comressed, int *err);
|
static gboolean wtap_dump_open_check(int filetype, int encap, gboolean comressed, int *err);
|
||||||
|
@ -945,30 +948,38 @@ void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped)
|
||||||
|
|
||||||
|
|
||||||
/* internally open a file for writing (compressed or not) */
|
/* internally open a file for writing (compressed or not) */
|
||||||
|
#ifdef HAVE_LIBZ
|
||||||
static FILE *wtap_dump_file_open(wtap_dumper *wdh, const char *filename)
|
static FILE *wtap_dump_file_open(wtap_dumper *wdh, const char *filename)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBZ
|
|
||||||
if(wdh->compressed) {
|
if(wdh->compressed) {
|
||||||
return gzopen(filename, "wb");
|
return gzopen(filename, "wb");
|
||||||
} else
|
} else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
return ws_fopen(filename, "wb");
|
return ws_fopen(filename, "wb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static FILE *wtap_dump_file_open(wtap_dumper *wdh _U_, const char *filename)
|
||||||
|
{
|
||||||
|
return ws_fopen(filename, "wb");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* internally open a file for writing (compressed or not) */
|
/* internally open a file for writing (compressed or not) */
|
||||||
|
#ifdef HAVE_LIBZ
|
||||||
static FILE *wtap_dump_file_fdopen(wtap_dumper *wdh, int fd)
|
static FILE *wtap_dump_file_fdopen(wtap_dumper *wdh, int fd)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBZ
|
|
||||||
if(wdh->compressed) {
|
if(wdh->compressed) {
|
||||||
return gzdopen(fd, "wb");
|
return gzdopen(fd, "wb");
|
||||||
} else
|
} else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
return fdopen(fd, "wb");
|
return fdopen(fd, "wb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static FILE *wtap_dump_file_fdopen(wtap_dumper *wdh _U_, int fd)
|
||||||
|
{
|
||||||
|
return fdopen(fd, "wb");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* internally writing raw bytes (compressed or not) */
|
/* internally writing raw bytes (compressed or not) */
|
||||||
size_t wtap_dump_file_write(wtap_dumper *wdh, const void *buf, unsigned bufsize)
|
size_t wtap_dump_file_write(wtap_dumper *wdh, const void *buf, unsigned bufsize)
|
||||||
|
|
|
@ -42,7 +42,7 @@ extern FILE_T file_open(const char *path, const char *mode);
|
||||||
|
|
||||||
#else /* No zLib */
|
#else /* No zLib */
|
||||||
|
|
||||||
#define file_open(path, mode) eth_fopen(path, mode)
|
#define file_open(path, mode) ws_fopen(path, mode)
|
||||||
#define filed_open fdopen
|
#define filed_open fdopen
|
||||||
/* XX: file_read and file_write defined to return number of *bytes* to be consistent with gzread & gzwrite */
|
/* XX: file_read and file_write defined to return number of *bytes* to be consistent with gzread & gzwrite */
|
||||||
#define file_read(buf, bsize, count, file) ((bsize) * fread((buf), (bsize), (count), (file)))
|
#define file_read(buf, bsize, count, file) ((bsize) * fread((buf), (bsize), (count), (file)))
|
||||||
|
|
Loading…
Reference in New Issue