🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #22389

Re: make inn bind only to a few ip numbers on linux..

#22389
From: Rahul Dhesi
Date: Tue, 14 Oct 1997 00:00
39 lines
2038 bytes
Bjxrn Hansen) writes:

>I have some virtual interfaces which INN not should know about.  
>It's now possible to connect to the nntp port of f.x. 194.192.97.35
>(eth0:35), which it should not be.

>How can I change this?

Below is what I added to inndstart.c, just before the bind() system
call.  It gets the desired host name from the INNHOST environment
variable.  Apply manually.

+    {
+#include <netdb.h>
+       struct hostent *hostent;
+       extern struct hostent *gethostbyname();
+       char *buf = getenv("INNHOST");
+       if (buf != NULL) {
+           server.sin_addr.s_addr = inet_addr(buf);
+           if (server.sin_addr.s_addr == (long) -1) {  /* not dotted quad */
+               hostent = gethostbyname(buf);
+               if (hostent == NULL) {
+                   /* unresolved host name */
+                   syslog(L_ERROR, "inndstart cant bind to unknown host %s",
+                                                                       buf);
+                   server.sin_addr.s_addr = htonl(INADDR_ANY);
+               } else {
+                   server.sin_family = hostent->h_addrtype;
+                   bcopy(hostent->h_addr,
+                       (caddr_t)&server.sin_addr, hostent->h_length);
+               }
+           }
+       }
+    }
-- 
Rahul Dhesi <dhesi@spams.r.us.com>

Technical Details
Message-ID: <61upvg$fre$1@samba.rahul.net>
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: <ask-1210972337120001@balder.netcetera.dk>

Show Full Headers
Complete Article Headers
Message-ID: <61upvg$fre$1@samba.rahul.net>
Subject: Re: make inn bind only to a few ip numbers on linux..
Date: Tue, 14 Oct 1997 00:00:00 +0000
From: c.c.eiftj@63.usenet.us.com (Rahul Dhesi)
References: <ask-1210972337120001@balder.netcetera.dk>
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: 280312202
Organization: a2i network
X-Comment: Encoded From: line allows replies that preserve original subject
NNTP-Posting-User: dhesi
Newsgroups: news.software.nntp