summaryrefslogtreecommitdiff
path: root/ringbuffer.c
diff options
context:
space:
mode:
authorSake Blok <sake@euronet.nl>2010-08-28 11:05:51 +0000
committerSake Blok <sake@euronet.nl>2010-08-28 11:05:51 +0000
commitf17c5ac01f9198a033f6c1cb97ee54676121453e (patch)
treecec416f861481d0c1acfba756b4f816347c974a4 /ringbuffer.c
parent42a0f16cef0e3009168d8c2ffa6987ffcf8ecca4 (diff)
downloadwireshark-f17c5ac01f9198a033f6c1cb97ee54676121453e.tar.gz
As mentioned on the users-mailinglist[1], it could be useful to have groups read access to the ringbuffer that dumpcap creates. That way, a group of people can access the capture files without having to use root access.
[1] http://www.wireshark.org/lists/wireshark-users/201008/msg00235.html svn path=/trunk/; revision=33978
Diffstat (limited to 'ringbuffer.c')
-rw-r--r--ringbuffer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ringbuffer.c b/ringbuffer.c
index ca94655438..541f009469 100644
--- a/ringbuffer.c
+++ b/ringbuffer.c
@@ -86,6 +86,7 @@ typedef struct _ringbuf_data {
int fd; /* Current ringbuffer file descriptor */
FILE *pdh;
+ gboolean group_read_access; /* TRUE if files need to be opened with group read access */
} ringbuf_data;
static ringbuf_data rb_data;
@@ -123,7 +124,8 @@ static int ringbuf_open_file(rb_file *rfile, int *err)
return -1;
}
- rb_data.fd = ws_open(rfile->name, O_RDWR|O_BINARY|O_TRUNC|O_CREAT, 0600);
+ rb_data.fd = ws_open(rfile->name, O_RDWR|O_BINARY|O_TRUNC|O_CREAT,
+ rb_data.group_read_access ? 0640 : 0600);
if (rb_data.fd == -1 && err != NULL) {
*err = errno;
@@ -136,7 +138,7 @@ static int ringbuf_open_file(rb_file *rfile, int *err)
* Initialize the ringbuffer data structures
*/
int
-ringbuf_init(const char *capfile_name, guint num_files)
+ringbuf_init(const char *capfile_name, guint num_files, gboolean group_read_access)
{
unsigned int i;
char *pfx, *last_pathsep;
@@ -149,6 +151,7 @@ ringbuf_init(const char *capfile_name, guint num_files)
rb_data.unlimited = FALSE;
rb_data.fd = -1;
rb_data.pdh = NULL;
+ rb_data.group_read_access = group_read_access;
/* just to be sure ... */
if (num_files <= RINGBUFFER_MAX_NUM_FILES) {