From ae316e2d888e3204f08593c27b4c2360eff7f679 Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Tue, 24 Nov 2015 23:03:13 +0100 Subject: Compile sshdump and ciscodump for Windows Use libSSH 0.7.2 compiled with MinGW(32|64) and linked with zlib and gcrypt support Change-Id: I7c17d1ba3dd1890e2f83c119f5ea851834807e43 Reviewed-on: https://code.wireshark.org/review/12117 Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- extcap/sshdump.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'extcap/sshdump.c') diff --git a/extcap/sshdump.c b/extcap/sshdump.c index 92ea9fded0..94cf27de19 100644 --- a/extcap/sshdump.c +++ b/extcap/sshdump.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -90,7 +91,7 @@ static void ssh_loop_read(ssh_channel channel, int fd) /* read from stdin until data are available */ do { nbytes = ssh_channel_read(channel, buffer, SSH_READ_BLOCK_SIZE, 0); - if (write(fd, buffer, nbytes) != nbytes) { + if (ws_write(fd, buffer, nbytes) != nbytes) { errmsg_print("ERROR reading: %s", g_strerror(errno)); return; } @@ -99,7 +100,7 @@ static void ssh_loop_read(ssh_channel channel, int fd) /* read loop finished... maybe something wrong happened. Read from stderr */ do { nbytes = ssh_channel_read(channel, buffer, SSH_READ_BLOCK_SIZE, 1); - if (write(STDERR_FILENO, buffer, nbytes) != nbytes) { + if (ws_write(STDERR_FILENO, buffer, nbytes) != nbytes) { return; } } while(nbytes > 0); @@ -188,9 +189,9 @@ static int ssh_open_remote_connection(const char* hostname, const unsigned int p if (g_strcmp0(fifo, "-")) { /* Open or create the output file */ - fd = open(fifo, O_WRONLY); + fd = ws_open(fifo, O_WRONLY, 0640); if (fd == -1) { - fd = open(fifo, O_WRONLY | O_CREAT, 0640); + fd = ws_open(fifo, O_WRONLY | O_CREAT, 0640); if (fd == -1) { errmsg_print("Error creating output file: %s", g_strerror(errno)); return EXIT_FAILURE; @@ -222,7 +223,7 @@ cleanup: ssh_cleanup(&sshs, &channel); if (g_strcmp0(fifo, "-")) - close(fd); + ws_close(fd); return ret; } @@ -258,7 +259,7 @@ static void help(const char* binname) printf(" --remote-filter : a filter for remote capture (default: don't listen on local local interfaces IPs)\n"); } -static char* interfaces_list_to_filter(GSList* interfaces, unsigned int remote_port) +static char* interfaces_list_to_filter(GSList* interfaces, const unsigned int remote_port) { GString* filter = g_string_new(NULL); GSList* cur; -- cgit v1.2.3