🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
4 messages
4 total messages Started by Etian Tue, 06 Feb 2018 17:17
sigsegv from vsprintf in nntpswitch
#87783
Author: Etian
Date: Tue, 06 Feb 2018 17:17
42 lines
2041 bytes
I am trying to run the "commercial" version which was released to the 
public after the wrongful take-down of newsservice. I've used the free 
version for 10 years.

Software source: https://github.com/tomarus/nntpswitch

It compiles, and the daemon runs fine.  But when a client connects, it 
is disconnected and a sigsegv is logged in news.err.

I used gdb to trace it to the vsprintf in this function in socket.c:

  * writeclient() write to the client
  * return 0 on success, -1 on failure
  */
PROTO int writeclient(CLIENT *client, char *str, ...)
{
	va_list ap;
	char response[cfg.BufSize];

	va_start (ap, str);
	vsprintf (response, str, ap);
	va_end (ap);

	return swriteclient(client, response);
}

It is called from this command in nntpd.c:

writeclient(client, "%u %s NNTPSwitch-%s, %u groups available, %s, slot 
%u, connections %u\r\n",
	client->posting ? 200 : 201,
	client->vhost->Banner,
	VERSION,
	master->numgroups,
	client->posting ? "posting allowed" : "no posting",
	client->id + 1,
	client->concur
);

Any ideas on what might be wrong?

Re: sigsegv from vsprintf in nntpswitch
#87785
Author: Richard Tobin
Date: Tue, 06 Feb 2018 17:52
49 lines
2356 bytes
In article <32b73$5a79e328$a6aa31a2$27781@news.sonic-news.com>,
Etian  <54698212@sonic-news.com> wrote:
>I am trying to run the "commercial" version which was released to the 
>public after the wrongful take-down of newsservice. I've used the free 
>version for 10 years.
>
>Software source: https://github.com/tomarus/nntpswitch
>
>It compiles, and the daemon runs fine.  But when a client connects, it 
>is disconnected and a sigsegv is logged in news.err.
>
>I used gdb to trace it to the vsprintf in this function in socket.c:
>
>  * writeclient() write to the client
>  * return 0 on success, -1 on failure
>  */
>PROTO int writeclient(CLIENT *client, char *str, ...)
>{
>	va_list ap;
>	char response[cfg.BufSize];
>
>	va_start (ap, str);
>	vsprintf (response, str, ap);
>	va_end (ap);
>
>	return swriteclient(client, response);
>}
>
>It is called from this command in nntpd.c:
>
>writeclient(client, "%u %s NNTPSwitch-%s, %u groups available, %s, slot 
>%u, connections %u\r\n",
>	client->posting ? 200 : 201,
>	client->vhost->Banner,
>	VERSION,
>	master->numgroups,
>	client->posting ? "posting allowed" : "no posting",
>	client->id + 1,
>	client->concur
>);
>
>Any ideas on what might be wrong?

The most obvious way for that code to get a segmentation fault is if
client->vhost->Banner is too long.

-- Richard

Re: sigsegv from vsprintf in nntpswitch
#87784
Author: Etian
Date: Tue, 06 Feb 2018 18:57
21 lines
1599 bytes
On 02/06/2018 11:52 AM, Richard Tobin wrote:
> 
> The most obvious way for that code to get a segmentation fault is if
> client->vhost->Banner is too long.
> 
> -- Richard
> 
Thank you. So I loaded into gdb again with a break before writeclient to 
check the variables it is being called with:
	print client->vhost->Banner

And I got this:
	Cannot access memory at address 0x100

So I think I'm missing defaults in the conf files required in the 
commercial version that weren't required for the free version.

I hope this solves it.


Re: sigsegv from vsprintf in nntpswitch
#87787
Author: Etian
Date: Sun, 11 Feb 2018 00:39
43 lines
2528 bytes
On 02/06/2018 12:57 PM, Etian wrote:
> On 02/06/2018 11:52 AM, Richard Tobin wrote:
>>
>> The most obvious way for that code to get a segmentation fault is if
>> client->vhost->Banner is too long.
>>
>> -- Richard
>>
> Thank you. So I loaded into gdb again with a break before writeclient to 
> check the variables it is being called with:
>      print client->vhost->Banner
> 
> And I got this:
>      Cannot access memory at address 0x100
> 
> So I think I'm missing defaults in the conf files required in the 
> commercial version that weren't required for the free version.
> 
> I hope this solves it.
> 
Solved!

For the benefit of anyone else trying to install this software and 
finding this thread, access.conf requires a vhost default stanza, like this:
vhost default
	Banner		news.you.com
	ReplaceBanner	1
	SSLKeyfile	/path/to/your/key with your certificate appended
	SSLCAList	/etc/ssl/certs/ca-certificates.crt
end

additional vhosts may be declared with additional IP addresses

vhost 123.456.789.012
	Banner		news.reseller.com
	SSLKeyfile	path to the key+certificate for that domain
end

It is a mighty fine nntp front-end that does authentication and 
bandwidth limiting, and combines multiple spools.  Thank you Tommy, 
wherever you are, and whatever you are photographing now.

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads