summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-11-28 00:33:28 +0000
committerGerald Combs <gerald@wireshark.org>2012-11-28 00:33:28 +0000
commitd94e3c803bfa1ba83b3b77740230648e159b8d36 (patch)
tree7d053f2b54a82b7194f06d74b7cea45f53513a8c
parent923d6213e0ba14e9733e5a3bf75bd663ff37d33c (diff)
downloadwireshark-d94e3c803bfa1ba83b3b77740230648e159b8d36.tar.gz
Copy over r46238 from the trunk:
------------------------------------------------------------------------ r46238 | morriss | 2012-11-27 15:05:03 -0800 (Tue, 27 Nov 2012) | 8 lines Changed paths: M /trunk/tshark.c Delay the reading of the hosts file ("-H") until after cf_open() has been called. (cf_open() calls init_dissection() which, since r45511, re-initializes the name resolution database.) Complain if the user gives an invalid argument to "-W". Specify the invalid argument if we don't like a "-z" argument. ------------------------------------------------------------------------ Update the release notes. svn path=/trunk-1.8/; revision=46241
-rw-r--r--docbook/release-notes.xml5
-rw-r--r--tshark.c25
2 files changed, 20 insertions, 10 deletions
diff --git a/docbook/release-notes.xml b/docbook/release-notes.xml
index 2df50e671d..d90f47430d 100644
--- a/docbook/release-notes.xml
+++ b/docbook/release-notes.xml
@@ -42,8 +42,8 @@ Wireshark Info
Wireshark could leak potentially sensitive host name resolution
information when working with multiple pcap-ng files. Discovered by
Laura Chappell.
- <!-- Fixed in trunk: r45511, r45674 -->
- <!-- Fixed in trunk-1.8: r46211 -->
+ <!-- Fixed in trunk: r45511, r45674, r46238 -->
+ <!-- Fixed in trunk-1.8: r46211, r46241 -->
</para>
<para>Versions affected: 1.8.0 to 1.8.3.</para>
<para>
@@ -77,7 +77,6 @@ Wireshark Info
The sFlow dissector could go into an infinite loop.
<!-- Fixed in trunk: r45324, r45329 -->
<!-- Fixed in trunk-1.8: r45578 -->
- <!-- Fixed in trunk-1.6: r? -->
(<ulink url="https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7789">Bug
7789</ulink>)
</para>
diff --git a/tshark.c b/tshark.c
index 95a46393f1..7262a6f806 100644
--- a/tshark.c
+++ b/tshark.c
@@ -849,6 +849,7 @@ main(int argc, char *argv[])
volatile int out_file_type = WTAP_FILE_PCAP;
#endif
volatile gboolean out_file_name_res = FALSE;
+ gchar *hosts_file = NULL;
gchar *volatile cf_name = NULL;
gchar *rfilter = NULL;
#ifdef HAVE_PCAP_OPEN_DEAD
@@ -1200,15 +1201,15 @@ main(int argc, char *argv[])
break;
case 'W': /* Select extra information to save in our capture file */
/* This is patterned after the -N flag which may not be the best idea. */
- if (strchr(optarg, 'n'))
+ if (strchr(optarg, 'n')) {
out_file_name_res = TRUE;
- break;
- case 'H': /* Read address to name mappings from a hosts file */
- if (! read_hosts_file(optarg))
- {
- cmdarg_err("Can't read host entries from \"%s\"", optarg);
+ } else {
+ cmdarg_err("Invalid -W argument \"%s\"", optarg);
return 1;
}
+ break;
+ case 'H': /* Read address to name mappings from a hosts file */
+ hosts_file = optarg;
out_file_name_res = TRUE;
break;
@@ -1386,7 +1387,7 @@ main(int argc, char *argv[])
part of a tap filter. Instead, we just add the argument
to a list of stat arguments. */
if (!process_stat_cmd_arg(optarg)) {
- cmdarg_err("invalid -z argument.");
+ cmdarg_err("Invalid -z argument \"%s\".", optarg);
cmdarg_err_cont(" -z argument must be one of :");
list_stat_cmd_args();
return 1;
@@ -1774,6 +1775,16 @@ main(int argc, char *argv[])
g_assert_not_reached();
}
+ /* Read in the hosts file after cf_open() (which calls init_dissection()
+ * which resets the name database).
+ */
+ if (hosts_file) {
+ if (! read_hosts_file(hosts_file)) {
+ cmdarg_err("Can't read host entries from \"%s\"", hosts_file);
+ return 1;
+ }
+ }
+
/* Process the packets in the file */
TRY {
#ifdef HAVE_LIBPCAP