🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #26722

Re: INN - change port

#26722
From: Todd C Miller
Date: Tue, 10 Mar 1998 00:00
86 lines
3271 bytes
From the keyboard of Bill Neely <billn@gct-us.com>:
> Can anyone tell me how to fire up INN (1.5) on a port other than 119.

This simple patch adds a -P option to inndstart indicating which
port innd should listen on.  I use this to run innd on port 433
(nnsp) nnrpd out of inetd on port 119 (nntp).  I used to just change
NNTP_PORT but there are things like actsync that use NNTP_PORT and
don't give you the option of overriding it.  Just because you want
the server to run on a different port it doesn't follow that all
the client progs should use that port too.

 - todd

*** innd/inndstart.c.DIST	Tue Oct  7 09:18:04 1997
--- innd/inndstart.c	Wed Nov  5 21:04:32 1997
***************
*** 71,76 ****
--- 71,77 ----
      char		buff[BUFSIZ];
      STRING		env[8];
      struct stat		Sb;
+     unsigned short	port;
  
      (void)openlog("inndstart", L_OPENLOG_FLAGS, LOG_INN_PROG);
  
***************
*** 82,87 ****
--- 83,99 ----
      NewsUID = Sb.st_uid;
      NewsGID = Sb.st_gid;
  
+     /* Did they give us -Pport? */
+     for (port = 0, i = 1; av[i]; i++) {
+ 	if (strncmp(av[i], "-P", 2) == 0) {
+ 	    if (av[i][2] != '\0' && (port = atoi(&av[i][2])) != 0)
+ 		    port = htons(port);
+ 	    break;
+ 	}
+     }
+     if (port == 0)
+ 	port = htons(NNTP_PORT);
+ 
      if (setgroups(1, &NewsGID) < 0)
          syslog(L_ERROR, "inndstart cant setgroups %m");
      
***************
*** 100,106 ****
  	syslog(L_ERROR, "inndstart cant setsockopt %m");
  #endif	/* defined(SO_REUSEADDR) */
      (void)memset((POINTER)&server, 0, sizeof server);
!     server.sin_port = htons(NNTP_PORT);
      server.sin_family = AF_INET;
      server.sin_addr.s_addr = htonl(INADDR_ANY);
      if (bind(i, (struct sockaddr *)&server, sizeof server) < 0) {
--- 112,118 ----
  	syslog(L_ERROR, "inndstart cant setsockopt %m");
  #endif	/* defined(SO_REUSEADDR) */
      (void)memset((POINTER)&server, 0, sizeof server);
!     server.sin_port = port;
      server.sin_family = AF_INET;
      server.sin_addr.s_addr = htonl(INADDR_ANY);
      if (bind(i, (struct sockaddr *)&server, sizeof server) < 0) {
***************
*** 121,128 ****
      argv[j++] = _PATH_INND;
      argv[j++] = pflag;
      for (i = 1; av[i]; ) {
! 	if (strncmp(av[i], "-p", 2) != 0)
! 	argv[j++] = av[i++];
  	else
  	    i++;
      }
--- 133,140 ----
      argv[j++] = _PATH_INND;
      argv[j++] = pflag;
      for (i = 1; av[i]; ) {
! 	if (av[i][0] != '-' || (av[i][1] != 'p' && av[i][1] != 'P'))
! 	    argv[j++] = av[i++];
  	else
  	    i++;
      }
-- 
     Todd C. Miller    Sysadmin/Consultant     Todd.Miller@courtesan.com

Technical Details
Message-ID: <6e3na1$fg1$1@xyzzy.courtesan.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: <3504B536.33D48839@gct-us.com>

Show Full Headers
Complete Article Headers
Message-ID: <6e3na1$fg1$1@xyzzy.courtesan.com>
Subject: Re: INN - change port
Date: Tue, 10 Mar 1998 00:00:00 +0000
From: Todd C Miller <millert@courtesan.com>
References: <3504B536.33D48839@gct-us.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: 332665368
Reply-To: millert@courtesan.com (Todd C Miller)
Organization: Courtesan Consulting
Newsgroups: news.software.nntp