aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2010-07-14 02:14:54 +0000
committerGuy Harris <guy@alum.mit.edu>2010-07-14 02:14:54 +0000
commit31c8eaf95e69214dcb74d885d525b09dcaccac8f (patch)
tree01819d222fab6ebee45a01d81541ab7fe4c4cd24 /dumpcap.c
parent7d45ac7dd5dc98c62be47a5eb6dddac13e6043a9 (diff)
Define relinquish_all_capabilities() before we use it.
If we get an "XXX is not one of the DLTs supported by this device" error when we try to set the link-layer header type, don't tell the user to report it to the Wireshark developers, as that's probably just the result of them giving a link-layer header type that the device doesn't support. svn path=/trunk/; revision=33512
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 34453528a5..c638884f68 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -476,6 +476,22 @@ cmdarg_err_cont(const char *fmt, ...)
}
}
+#ifdef HAVE_LIBCAP
+static void
+relinquish_all_capabilities(void)
+{
+ /* Drop any and all capabilities this process may have. */
+ /* Allowed whether or not process has any privileges. */
+ cap_t caps = cap_init(); /* all capabilities initialized to off */
+ print_caps("Pre-clear");
+ if (cap_set_proc(caps)) {
+ cmdarg_err("cap_set_proc() fail return: %s", strerror(errno));
+ }
+ print_caps("Post-clear");
+ cap_free(caps);
+}
+#endif
+
static pcap_t *
open_capture_device(capture_options *capture_opts, char *open_err_str,
size_t open_err_str_size)
@@ -637,7 +653,14 @@ set_pcap_linktype(pcap_t *pcap_h, capture_options *capture_opts,
#endif
g_snprintf(errmsg, (gulong) errmsg_len, "Unable to set data link type (%s).",
set_linktype_err_str);
- g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len, please_report);
+ /*
+ * If the error isn't "XXX is not one of the DLTs supported by this device",
+ * tell the user to tell the Wireshark developers about it.
+ */
+ if (strstr(set_linktype_err_str, "is not one of the DLTs supported by this device") == NULL)
+ g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len, please_report);
+ else
+ secondary_errmsg[0] = '\0';
return FALSE;
}
@@ -1411,21 +1434,6 @@ relinquish_privs_except_capture(void)
}
}
-
-static void
-relinquish_all_capabilities(void)
-{
- /* Drop any and all capabilities this process may have. */
- /* Allowed whether or not process has any privileges. */
- cap_t caps = cap_init(); /* all capabilities initialized to off */
- print_caps("Pre-clear");
- if (cap_set_proc(caps)) {
- cmdarg_err("cap_set_proc() fail return: %s", strerror(errno));
- }
- print_caps("Post-clear");
- cap_free(caps);
-}
-
#endif /* HAVE_LIBCAP */
/* Take care of byte order in the libpcap headers read from pipes.