2010-11-26 13:30:45 +00:00
|
|
|
Customize 'permission denied' error.
|
|
|
|
|
|
|
|
From: Jan Safranek <jsafrane@redhat.com>
|
|
|
|
|
|
|
|
Add Fedora-specific message to error output when dumpcap cannot be started
|
|
|
|
because of permissions.
|
|
|
|
|
|
|
|
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
|
|
|
|
|
2011-07-21 09:20:56 +00:00
|
|
|
diff -up wireshark-1.6.1/capture_sync.c.group-msg wireshark-1.6.1/capture_sync.c
|
|
|
|
--- wireshark-1.6.1/capture_sync.c.group-msg 2011-07-18 22:18:53.000000000 +0200
|
|
|
|
+++ wireshark-1.6.1/capture_sync.c 2011-07-21 10:52:28.962144991 +0200
|
|
|
|
@@ -351,6 +351,7 @@ sync_pipe_start(capture_options *capture
|
2010-11-26 13:30:45 +00:00
|
|
|
gchar *signal_pipe_name;
|
|
|
|
#else
|
|
|
|
char errmsg[1024+1];
|
|
|
|
+ const char *securitymsg = "";
|
|
|
|
int sync_pipe[2]; /* pipe used to send messages from child to parent */
|
|
|
|
enum PIPES { PIPE_READ, PIPE_WRITE }; /* Constants 0 and 1 for PIPE_READ and PIPE_WRITE */
|
|
|
|
#endif
|
2011-07-21 09:20:56 +00:00
|
|
|
@@ -596,8 +597,10 @@ sync_pipe_start(capture_options *capture
|
2010-11-26 13:30:45 +00:00
|
|
|
dup2(sync_pipe[PIPE_WRITE], 2);
|
|
|
|
ws_close(sync_pipe[PIPE_READ]);
|
|
|
|
execv(argv[0], (gpointer)argv);
|
|
|
|
- g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
|
2011-07-21 09:20:56 +00:00
|
|
|
- argv[0], g_strerror(errno));
|
2010-11-26 13:30:45 +00:00
|
|
|
+ if (errno == EPERM || errno == EACCES)
|
2011-07-21 09:20:56 +00:00
|
|
|
+ securitymsg = "\nAre you memeber of 'wireshark' group? Try running\n'usermod -a -G wireshark _your_username_' as root.";
|
2010-11-26 13:30:45 +00:00
|
|
|
+ g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s%s",
|
2011-07-21 09:20:56 +00:00
|
|
|
+ argv[0], g_strerror(errno), securitymsg);
|
2010-11-26 13:30:45 +00:00
|
|
|
sync_pipe_errmsg_to_parent(2, errmsg, "");
|
|
|
|
|
|
|
|
/* Exit with "_exit()", so that we don't close the connection
|
2011-07-21 09:20:56 +00:00
|
|
|
@@ -687,6 +690,7 @@ sync_pipe_open_command(const char** argv
|
2010-11-26 13:30:45 +00:00
|
|
|
int i;
|
|
|
|
#else
|
|
|
|
char errmsg[1024+1];
|
|
|
|
+ const char *securitymsg = "";
|
|
|
|
int sync_pipe[2]; /* pipe used to send messages from child to parent */
|
|
|
|
int data_pipe[2]; /* pipe used to send data from child to parent */
|
|
|
|
#endif
|
2011-07-21 09:20:56 +00:00
|
|
|
@@ -811,8 +815,10 @@ sync_pipe_open_command(const char** argv
|
2010-11-26 13:30:45 +00:00
|
|
|
ws_close(sync_pipe[PIPE_READ]);
|
|
|
|
ws_close(sync_pipe[PIPE_WRITE]);
|
|
|
|
execv(argv[0], (gpointer)argv);
|
|
|
|
- g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
|
2011-07-21 09:20:56 +00:00
|
|
|
- argv[0], g_strerror(errno));
|
|
|
|
+ if (errno == EPERM || errno == EACCES)
|
|
|
|
+ securitymsg = "\nAre you memeber of 'wireshark' group? Try running\n'usermod -a -G wireshark _your_username_' as root.";
|
2010-11-26 13:30:45 +00:00
|
|
|
+ g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s%s",
|
2011-07-21 09:20:56 +00:00
|
|
|
+ argv[0], g_strerror(errno), securitymsg);
|
2010-11-26 13:30:45 +00:00
|
|
|
sync_pipe_errmsg_to_parent(2, errmsg, "");
|
|
|
|
|
|
|
|
/* Exit with "_exit()", so that we don't close the connection
|