Re: unveil for audioctl

2018-09-17 Thread Alexandre Ratchov
On Mon, Sep 17, 2018 at 01:27:03PM +0100, Ricardo Mestre wrote:
> And of course I missed disabling unveil(2) just right the first call...
> 
> Index: audioctl.c
> ===
> RCS file: /cvs/src/usr.bin/audioctl/audioctl.c,v
> retrieving revision 1.35
> diff -u -p -u -r1.35 audioctl.c
> --- audioctl.c31 May 2017 04:18:58 -  1.35
> +++ audioctl.c17 Sep 2018 12:26:30 -
> @@ -217,6 +217,11 @@ main(int argc, char **argv)
>   argc -= optind;
>   argv += optind;
>  
> + if (unveil(path, "rw") == -1)
> + err(1, "unveil");
> + if (unveil(NULL, NULL) == -1)
> + err(1, "unveil");
> +
>   fd = open(path, O_RDWR);
>   if (fd < 0)
>   err(1, "%s", path);

looks fine, thanks.

ok ratchov



Re: unveil for audioctl

2018-09-17 Thread Ricardo Mestre
And of course I missed disabling unveil(2) just right the first call...

Index: audioctl.c
===
RCS file: /cvs/src/usr.bin/audioctl/audioctl.c,v
retrieving revision 1.35
diff -u -p -u -r1.35 audioctl.c
--- audioctl.c  31 May 2017 04:18:58 -  1.35
+++ audioctl.c  17 Sep 2018 12:26:30 -
@@ -217,6 +217,11 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
 
+   if (unveil(path, "rw") == -1)
+   err(1, "unveil");
+   if (unveil(NULL, NULL) == -1)
+   err(1, "unveil");
+
fd = open(path, O_RDWR);
if (fd < 0)
err(1, "%s", path);

On 13:22 Mon 17 Sep , Ricardo Mestre wrote:
> Hi,
> 
> This adds unveil(2) to audioctl(1) which only needs rw to the access control
> device, which by default is /dev/audioctl0, but can be manipulated via args.
> 
> OK?
> 



unveil for audioctl

2018-09-17 Thread Ricardo Mestre
Hi,

This adds unveil(2) to audioctl(1) which only needs rw to the access control
device, which by default is /dev/audioctl0, but can be manipulated via args.

OK?

Index: audioctl.c
===
RCS file: /cvs/src/usr.bin/audioctl/audioctl.c,v
retrieving revision 1.35
diff -u -p -u -r1.35 audioctl.c
--- audioctl.c  31 May 2017 04:18:58 -  1.35
+++ audioctl.c  17 Sep 2018 12:16:03 -
@@ -217,6 +217,9 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
 
+   if (unveil(path, "rw") == -1)
+   err(1, "unveil");
+
fd = open(path, O_RDWR);
if (fd < 0)
err(1, "%s", path);