|
|
164878 |
From: Jan Safranek <jsafrane@redhat.com>
|
|
|
164878 |
Date: Fri, 26 Nov 2010 14:30:45 +0300
|
|
|
164878 |
Subject: [PATCH] Customize 'permission denied' error.
|
|
|
164878 |
|
|
|
164878 |
Add Fedora-specific message to error output when dumpcap cannot be started
|
|
|
164878 |
because of permissions.
|
|
|
164878 |
|
|
|
164878 |
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
|
|
|
164878 |
|
|
|
164878 |
diff --git a/capchild/capture_sync.c b/capchild/capture_sync.c
|
|
|
164878 |
index 2f9d2cc..b18e47f 100644
|
|
|
164878 |
--- a/capchild/capture_sync.c
|
|
|
164878 |
+++ b/capchild/capture_sync.c
|
|
|
164878 |
@@ -375,6 +375,7 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi
|
|
|
164878 |
gchar *signal_pipe_name;
|
|
|
164878 |
#else
|
|
|
164878 |
char errmsg[1024+1];
|
|
|
164878 |
+ const char *securitymsg = "";
|
|
|
164878 |
int sync_pipe[2]; /* pipe used to send messages from child to parent */
|
|
|
164878 |
enum PIPES { PIPE_READ, PIPE_WRITE }; /* Constants 0 and 1 for PIPE_READ and PIPE_WRITE */
|
|
|
164878 |
#endif
|
|
|
164878 |
@@ -728,8 +729,11 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi
|
|
|
164878 |
dup2(sync_pipe[PIPE_WRITE], 2);
|
|
|
164878 |
ws_close(sync_pipe[PIPE_READ]);
|
|
|
164878 |
execv(argv[0], argv);
|
|
|
164878 |
- g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
|
|
|
164878 |
- argv[0], g_strerror(errno));
|
|
|
164878 |
+ if (errno == EPERM || errno == EACCES)
|
|
|
164878 |
+ securitymsg = "\nAre you a member of the 'wireshark' group? Try running\n'usermod -a -G wireshark _your_username_' as root.";
|
|
|
164878 |
+ g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s%s",
|
|
|
164878 |
+ argv[0], g_strerror(errno), securitymsg);
|
|
|
164878 |
+
|
|
|
164878 |
sync_pipe_errmsg_to_parent(2, errmsg, "");
|
|
|
164878 |
|
|
|
164878 |
/* Exit with "_exit()", so that we don't close the connection
|
|
|
164878 |
@@ -826,6 +830,7 @@ sync_pipe_open_command(char** argv, int *data_read_fd,
|
|
|
164878 |
int i;
|
|
|
164878 |
#else
|
|
|
164878 |
char errmsg[1024+1];
|
|
|
164878 |
+ const char *securitymsg = "";
|
|
|
164878 |
int sync_pipe[2]; /* pipe used to send messages from child to parent */
|
|
|
164878 |
int data_pipe[2]; /* pipe used to send data from child to parent */
|
|
|
164878 |
#endif
|
|
|
164878 |
@@ -1003,8 +1008,11 @@ sync_pipe_open_command(char** argv, int *data_read_fd,
|
|
|
164878 |
ws_close(sync_pipe[PIPE_READ]);
|
|
|
164878 |
ws_close(sync_pipe[PIPE_WRITE]);
|
|
|
164878 |
execv(argv[0], argv);
|
|
|
164878 |
- g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
|
|
|
164878 |
- argv[0], g_strerror(errno));
|
|
|
164878 |
+ execv(argv[0], (gpointer)argv);
|
|
|
164878 |
+ if (errno == EPERM || errno == EACCES)
|
|
|
164878 |
+ securitymsg = "\nAre you a member of the 'wireshark' group? Try running\n'usermod -a -G wireshark _your_username_' as root.";
|
|
|
164878 |
+ g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s%s",
|
|
|
164878 |
+ argv[0], g_strerror(errno), securitymsg);
|
|
|
164878 |
sync_pipe_errmsg_to_parent(2, errmsg, "");
|
|
|
164878 |
|
|
|
164878 |
/* Exit with "_exit()", so that we don't close the connection
|