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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: gotwebd: listen on localhost by default
To:
gameoftrees@openbsd.org
Date:
Fri, 19 Aug 2022 18:55:02 +0200

Download raw body.

Thread
On Fri, Aug 19, 2022 at 06:52:11PM +0200, Stefan Sperling wrote:
> And now, without an explicit port number set in the config file,
> gotwebd listens on the wrong port number because of a byte-swap bug.
> 

I forgot to include netstat output.

Before:
tcp          0      0  127.0.0.1.10275        *.*                    LISTEN
tcp6         0      0  ::1.10275              *.*                    LISTEN

After:
tcp          0      0  127.0.0.1.9000         *.*                    LISTEN
tcp6         0      0  ::1.9000               *.*                    LISTEN

> Fix below.  ok?
> 
> diff 2fb25d87ff7b3572bc98a7bea5f7380727b180e5 d11ed2537445b24cfe6b79e6c20d5731b8a07e27
> commit - 2fb25d87ff7b3572bc98a7bea5f7380727b180e5
> commit + d11ed2537445b24cfe6b79e6c20d5731b8a07e27
> blob - 5063726b9a209a27338b1b4ac917758c171bcac9
> blob + b23d9fe465844dc654c2dce903331128cc7ae3f1
> --- gotwebd/parse.y
> +++ gotwebd/parse.y
> @@ -922,7 +922,7 @@ conf_new_server(const char *name)
>  
>  	val = getservice(D_FCGI_PORT);
>  	srv->fcgi_socket_port = gotwebd->fcgi_socket_port ?
> -	    gotwebd->fcgi_socket_port: htons(val);
> +	    gotwebd->fcgi_socket_port: val;
>  
>  	srv->show_site_owner = D_SHOWSOWNER;
>  	srv->show_repo_owner = D_SHOWROWNER;
> @@ -1037,7 +1037,7 @@ getservice(const char *n)
>  			s = getservbyname(n, "udp");
>  		if (s == NULL)
>  			return (-1);
> -		return (s->s_port);
> +		return htons(s->s_port);
>  	}
>  
>  	return (htons((unsigned short)llval));
> 
>