🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #35398

Re: nnrpd daemon (-D) mode fixes

#35398
From: Aidan Cully
Date: Fri, 12 Feb 1999 00:00
36 lines
2355 bytes
In news.software.nntp, davidsen@tmr.com (bill davidsen) wrote:
> In article <79t2ms$iil$1@news1.epix.net>,
> Forrest J. Cavalier III <mibsoft@mibsoftware.com> wrote:
> 
> | Bill, your "corrected" code fails if a sizeof(sockaddr_in) is
> | larger than sizeof(sockaddr).  (What should happen is that
> | accept() would see a wrong length member and return an error.)
> 
> Then perhaps the prototype is wrong, since it requires sockaddr.

Looked at a certain way, it's wrong that it's prototyped.  But if
you're going to prototype it, you should use a sockaddr, or maybe
extern int accept __P((...)); (but I don't really like that one).

> If so,
> it's wrong on a LOT of systems... which is why I assumed that the
> prototype was correct and the source was wrong. If that's the case it's
> wrong on at least Linux, BSD, SCO and AIX, I checked there before I
> changed it.

The same function can take structures of several different types..
sockaddr_in and sockaddr_un are the most common, I think, but there's
another one for IPv6, and for the appletalk protocol..  All these
types are "derived" from struct sockaddr, and the kernel will dispatch
them to different internal functions based on the s*_family field
(which is at the same offset in all struct sockaddr_*s).

What do you think the correct way to do this is?

--aidan
-- 
Aidan Cully       "Umm..  Could you call back?  My house is on fire."
Panix Staff          --Tom Waits
aidan@panix.com

Technical Details
Message-ID: <7a20i6$lll$1@panix7.panix.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <79eufj$7nh0$1@newssvr04-int.news.prodigy.com> <79smvr$7ni8$1@newssvr04-int.news.prodigy.com> <79t2ms$iil$1@news1.epix.net> <7a1t47$8rka$1@newssvr04-int.news.prodigy.com>

Show Full Headers
Complete Article Headers
Message-ID: <7a20i6$lll$1@panix7.panix.com>
Subject: Re: nnrpd daemon (-D) mode fixes
Date: Fri, 12 Feb 1999 00:00:00 +0000
From: aidan@panix.com (Aidan Cully)
References: <79eufj$7nh0$1@newssvr04-int.news.prodigy.com> <79smvr$7ni8$1@newssvr04-int.news.prodigy.com> <79t2ms$iil$1@news1.epix.net> <7a1t47$8rka$1@newssvr04-int.news.prodigy.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 443723536
Distribution: inet
X-Complaints-To: usenet@panix.com
X-Trace: news.panix.com 918848902 7571 166.84.0.232 (12 Feb 1999 19:48:22 GMT)
Organization: PANIX -- Public Access Networks Corp
NNTP-Posting-Date: 12 Feb 1999 19:48:22 GMT
Newsgroups: news.software.nntp