"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: add gotd.conf connection options
To:
Stefan Sperling <stsp@stsp.name>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 03 Jan 2023 10:22:12 +0100

Download raw body.

Thread
On 2023/01/03 10:16:35 +0100, Stefan Sperling <stsp@stsp.name> wrote:
> On Tue, Jan 03, 2023 at 10:02:26AM +0100, Omar Polo wrote:
> > On 2023/01/03 00:16:40 +0100, Stefan Sperling <stsp@stsp.name> wrote:
> > > @@ -135,6 +139,16 @@ main		: UNIX_SOCKET STRING {
> > >  		| NUMBER { $$ = $1; }
> > >  		;
> > >  
> > > +timeout		: NUMBER {
> > > +			if ($1 < 0) {
> > 
> > should zero be disallowed too?
> 
> Not when parsing a raw timeout value. We might at some point add a timeout
> config knob where zero would mean "forever". But the request timeout value
> should indeed be > 0, see diff below. ok?

ah, right.  ok

> diff /home/stsp/src/got
> commit - 40b85cca5d86ebef3a353efd464af989c3ebf18b
> path + /home/stsp/src/got
> blob - 580f43381ccf163eac2c738800e7efd25c7562e4
> file + gotd/parse.y
> --- gotd/parse.y
> +++ gotd/parse.y
> @@ -194,6 +194,10 @@ conflags	: REQUEST TIMEOUT timeout		{
>  		;
>  
>  conflags	: REQUEST TIMEOUT timeout		{
> +			if ($3.tv_sec <= 0) {
> +				yyerror("invalid timeout: %lld", $3.tv_sec);
> +				YYERROR;
> +			}
>  			memcpy(&gotd->request_timeout, &$3,
>  			    sizeof(gotd->request_timeout));
>  		}