Re: usbhidaction(1) is unvel(2)ed too strictly to run programs.

2022-08-02 Thread Ricardo Mestre
Thanks for testing, it's committed now!

On 09:33 Mon 01 Aug , Hector Velasco wrote:
> Hi Ricardo:
> 
> I tested the patch and it's working great. The solution seems obvious
> now that I see it :).
> 



Re: usbhidaction(1) is unvel(2)ed too strictly to run programs.

2022-08-01 Thread Hector Velasco
Hi Ricardo:

I tested the patch and it's working great. The solution seems obvious
now that I see it :).

suzaku@burningdawn:~ $ > doas rcctl stop usbhidaction
suzaku@burningdawn:~ $ > doas usbhidaction -v -c /etc/usbhidaction.conf -f 
/dev/uhid2
PARSE:1 Consumer:Volume_Increment, 1, 'sndioctl output.level=+0.05'
PARSE:2 Consumer:Volume_Decrement, 1, 'sndioctl output.level=-0.05'
PARSE:3 Consumer:Mute, 1, 'sndioctl output.mute=!'
PARSE:4 Consumer:Play/Pause, 1, 'mpc -q toggle'
PARSE:5 Consumer:Scan_Previous_Track, 1, 'mpc -q prev'
PARSE:6 Consumer:Scan_Next_Track, 1, 'mpc -q next'
PARSE:7 Consumer:Random_Play, 1, 'mpc -q random'
PARSE:8 Consumer:Stop, 1, 'mpc -q stop'
PARSE:9 Consumer:Fast_Forward, 1, 'mpc -q seek +10'
PARSE:10 Consumer:Rewind, 1, 'mpc -q seek -10'
report size 2
executing 'mpc -q toggle'
executing 'mpc -q prev'
executing 'mpc -q random'
executing 'mpc -q next'
executing 'mpc -q seek -10'
executing 'mpc -q seek +10'
executing 'mpc -q stop'
executing 'sndioctl output.level=+0.05'
output.level=0.392
executing 'sndioctl output.mute=!'
output.mute=0
executing 'sndioctl output.level=-0.05'
output.level=0.341
^C
suzaku@burningdawn:~ $ >

Thanks for the patch.

Regards.

HV


On Mon, Aug 01, 2022 at 12:11:48PM +0100, Ricardo Mestre wrote:
> ouch, how did I miss the call to execl(3) on docmd()? silly me!
> 
> OK?
> 
> Index: usbhidaction.c
> ===
> RCS file: /cvs/src/usr.bin/usbhidaction/usbhidaction.c,v
> retrieving revision 1.24
> diff -u -p -u -r1.24 usbhidaction.c
> --- usbhidaction.c15 Dec 2021 11:23:09 -  1.24
> +++ usbhidaction.c1 Aug 2022 11:08:31 -
> @@ -166,6 +166,8 @@ main(int argc, char **argv)
>  
>   if (unveil(conf, "r") == -1)
>   err(1, "unveil %s", conf);
> + if (unveil(_PATH_BSHELL, "x") == -1)
> + err(1, "unveil %s", _PATH_BSHELL);
>   if (unveil(NULL, NULL) == -1)
>   err(1, "unveil");
>  
> 
> 
> On 15:42 Sat 30 Jul , Theo de Raadt wrote:
> > I suspect it should unveil("/", "x")
> > 
> > It is better than not doing anything.
> > 



Re: usbhidaction(1) is unvel(2)ed too strictly to run programs.

2022-08-01 Thread Ricardo Mestre
ouch, how did I miss the call to execl(3) on docmd()? silly me!

OK?

Index: usbhidaction.c
===
RCS file: /cvs/src/usr.bin/usbhidaction/usbhidaction.c,v
retrieving revision 1.24
diff -u -p -u -r1.24 usbhidaction.c
--- usbhidaction.c  15 Dec 2021 11:23:09 -  1.24
+++ usbhidaction.c  1 Aug 2022 11:08:31 -
@@ -166,6 +166,8 @@ main(int argc, char **argv)
 
if (unveil(conf, "r") == -1)
err(1, "unveil %s", conf);
+   if (unveil(_PATH_BSHELL, "x") == -1)
+   err(1, "unveil %s", _PATH_BSHELL);
if (unveil(NULL, NULL) == -1)
err(1, "unveil");
 


On 15:42 Sat 30 Jul , Theo de Raadt wrote:
> I suspect it should unveil("/", "x")
> 
> It is better than not doing anything.
> 



Re: usbhidaction(1) is unvel(2)ed too strictly to run programs.

2022-07-30 Thread Theo de Raadt
I suspect it should unveil("/", "x")

It is better than not doing anything.