diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2015-04-10 19:04:22 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2015-04-13 17:43:40 +0000 |
commit | 2e8d8e12cdc490488b8dc221f430f62dc7ad171c (patch) | |
tree | 0c09b8c35858424a9a4a60036688f8730decaa51 /dumpcap.c | |
parent | 9ea521532ee7fdf7c8962817592bb3d64723deb6 (diff) |
dumpcap: fix opening of pipes on Windows broken since gbed29af
Previous code was assuming that all local pipes were of extcap type. Let's explicitly check for extcap prefix now.
Bug: 10803
Change-Id: If955e77a9ee2af11b553740269964c40273d5177
Reviewed-on: https://code.wireshark.org/review/8013
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -163,6 +163,10 @@ #include "caputils/ws80211_utils.h" +#ifdef HAVE_EXTCAP +#include "extcap.h" +#endif + /* * Get information about libpcap format from "wiretap/libpcap.h". * XXX - can we just use pcap_open_offline() to read the pipe? @@ -2045,6 +2049,10 @@ cap_pipe_open_live(char *pipename, char *pncopy, *pos; wchar_t *err_str; interface_options interface_opts; +#ifdef HAVE_EXTCAP + char* extcap_pipe_name; + gboolean extcap_pipe; +#endif #endif ssize_t b; int fd = -1, sel_ret; @@ -2054,6 +2062,7 @@ cap_pipe_open_live(char *pipename, #ifdef _WIN32 pcap_opts->cap_pipe_h = INVALID_HANDLE_VALUE; #endif + g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "cap_pipe_open_live: %s", pipename); /* @@ -2181,13 +2190,20 @@ cap_pipe_open_live(char *pipename, } interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, 0); +#ifdef HAVE_EXTCAP + extcap_pipe_name = g_strconcat("\\\\.\\pipe\\", EXTCAP_PIPE_PREFIX, NULL); + extcap_pipe = strstr(interface_opts.name, extcap_pipe_name) ? TRUE : FALSE; + g_free(extcap_pipe_name); +#endif /* Wait for the pipe to appear */ while (1) { - if(strncmp(interface_opts.name,"\\\\.\\pipe\\",9)== 0) +#ifdef HAVE_EXTCAP + if(extcap_pipe) pcap_opts->cap_pipe_h = GetStdHandle(STD_INPUT_HANDLE); else +#endif pcap_opts->cap_pipe_h = CreateFile(utf_8to16(pipename), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); |