Blame SOURCES/wireshark-1.6.1-group-msg.patch

ead5f6
Customize 'permission denied' error.
ead5f6
ead5f6
Add Fedora-specific message to error output when dumpcap cannot be started
ead5f6
because of permissions.
ead5f6
ead5f6
diff --git a/capture_sync.c b/capture_sync.c
ead5f6
index 8c49ed2..65e242d 100644
ead5f6
--- a/capture_sync.c
ead5f6
+++ b/capture_sync.c
dbc6ab
@@ -369,6 +369,7 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session)
ead5f6
     gchar *signal_pipe_name;
ead5f6
 #else
ead5f6
     char errmsg[1024+1];
ead5f6
+    const char *securitymsg = "";
ead5f6
     int sync_pipe[2];                       /* pipe used to send messages from child to parent */
ead5f6
     enum PIPES { PIPE_READ, PIPE_WRITE };   /* Constants 0 and 1 for PIPE_READ and PIPE_WRITE */
ead5f6
 #endif
dbc6ab
@@ -639,8 +640,10 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session)
ead5f6
         dup2(sync_pipe[PIPE_WRITE], 2);
ead5f6
         ws_close(sync_pipe[PIPE_READ]);
ead5f6
         execv(argv[0], argv);
ead5f6
-        g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
ead5f6
-                   argv[0], g_strerror(errno));
ead5f6
+        if (errno == EPERM || errno == EACCES)
ead5f6
+            securitymsg = "\nAre you a member of the 'wireshark' group? Try running\n'usermod -a -G wireshark _your_username_' as root.";
ead5f6
+        g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s%s",
ead5f6
+            argv[0], g_strerror(errno), securitymsg);
ead5f6
         sync_pipe_errmsg_to_parent(2, errmsg, "");
ead5f6
 
ead5f6
         /* Exit with "_exit()", so that we don't close the connection
dbc6ab
@@ -732,6 +735,7 @@ sync_pipe_open_command(char** argv, int *data_read_fd,
ead5f6
     PROCESS_INFORMATION pi;
ead5f6
 #else
ead5f6
     char errmsg[1024+1];
ead5f6
+    const char *securitymsg = "";
ead5f6
     int sync_pipe[2];                       /* pipe used to send messages from child to parent */
ead5f6
     int data_pipe[2];                       /* pipe used to send data from child to parent */
ead5f6
 #endif
dbc6ab
@@ -866,8 +870,10 @@ sync_pipe_open_command(char** argv, int *data_read_fd,
ead5f6
         ws_close(sync_pipe[PIPE_READ]);
ead5f6
         ws_close(sync_pipe[PIPE_WRITE]);
ead5f6
         execv(argv[0], argv);
ead5f6
-        g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
ead5f6
-                   argv[0], g_strerror(errno));
ead5f6
+        if (errno == EPERM || errno == EACCES)
ead5f6
+            securitymsg = "\nAre you a member of the 'wireshark' group? Try running\n'usermod -a -G wireshark _your_username_' as root.";
ead5f6
+        g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s%s",
ead5f6
+            argv[0], g_strerror(errno), securitymsg);
ead5f6
         sync_pipe_errmsg_to_parent(2, errmsg, "");
ead5f6
 
ead5f6
         /* Exit with "_exit()", so that we don't close the connection