diff options
author | Sake Blok <sake@euronet.nl> | 2010-08-28 11:05:51 +0000 |
---|---|---|
committer | Sake Blok <sake@euronet.nl> | 2010-08-28 11:05:51 +0000 |
commit | f17c5ac01f9198a033f6c1cb97ee54676121453e (patch) | |
tree | cec416f861481d0c1acfba756b4f816347c974a4 /ringbuffer.c | |
parent | 42a0f16cef0e3009168d8c2ffa6987ffcf8ecca4 (diff) | |
download | wireshark-f17c5ac01f9198a033f6c1cb97ee54676121453e.tar.gz wireshark-f17c5ac01f9198a033f6c1cb97ee54676121453e.tar.bz2 wireshark-f17c5ac01f9198a033f6c1cb97ee54676121453e.zip |
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.c | 7 |
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) { |