summaryrefslogtreecommitdiff
path: root/extcap
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2015-11-24 23:03:13 +0100
committerAnders Broman <a.broman58@gmail.com>2016-04-25 07:22:28 +0000
commitae316e2d888e3204f08593c27b4c2360eff7f679 (patch)
tree26baec1e2daaee3578b4ae8450831703c47c877a /extcap
parentc3574ed4173917f6ad89f40ab0b0dc0b1ad5e62d (diff)
downloadwireshark-ae316e2d888e3204f08593c27b4c2360eff7f679.tar.gz
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 <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'extcap')
-rw-r--r--extcap/Makefile.nmake2
-rw-r--r--extcap/ssh-base.c2
-rw-r--r--extcap/sshdump.c13
3 files changed, 10 insertions, 7 deletions
diff --git a/extcap/Makefile.nmake b/extcap/Makefile.nmake
index 22e27e9b8a..0641e1e060 100644
--- a/extcap/Makefile.nmake
+++ b/extcap/Makefile.nmake
@@ -76,7 +76,7 @@ ciscodump_LIBS = $(ciscodump_WSLIBS) \
EXECUTABLES=androiddump.exe randpktdump.exe
!IFDEF LIBSSH_DIR
-EXECUTABLES += sshdump.exe ciscodump.exe
+EXECUTABLES = $(EXECUTABLES) sshdump.exe ciscodump.exe
!ENDIF
all: $(EXECUTABLES)
diff --git a/extcap/ssh-base.c b/extcap/ssh-base.c
index 830485df3d..cec0856105 100644
--- a/extcap/ssh-base.c
+++ b/extcap/ssh-base.c
@@ -22,6 +22,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "config.h"
+
#include "ssh-base.h"
#include <extcap/extcap-base.h>
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 <extcap/extcap-base.h>
#include <wsutil/interface.h>
+#include <wsutil/file_util.h>
#include <extcap/ssh-base.h>
#include <errno.h>
@@ -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 <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;