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

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