🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.b
Article #2411

B-news inews patch to Message-ID line

#2411
From: Nick Sayer
Date: Sun, 26 Aug 1990 05:50
85 lines
2864 bytes
B-news 2.11.19 uses a numeric sequence kept in a file in $LIBDIR
to obtain unique message IDs for each message. Below is a small
patch to ifuncs.c that will change the message ID to include
the c-time (num of seconds since the epoch), the process id, and
the system name. The disadvantage to this scheme is that
your system MUST maintain an accurate, or at least constantly
increasing, time-of-day. If your clock backtracks, it is possible
(though still unlikely) to have two messages with the same ID.
Since the PID is also part of the ID, two messages posted at
the same time will still be unique. This falls apart if
getpid() doesn't produce unique results for each process CURRENTLY
running.

send this into patch and remake inews.

This is a NON-STANDARD patch. Keep the patch file around
so you can undo it if someone makes B-news 2.11.20.

If you're a purist, you can also remove references to SEQFILE
from pathinit.c

Feedback cheerfully accepted.

*** ifuncs.c.o	Sat Aug 25 22:24:02 1990
--- ifuncs.c	Sat Aug 25 22:31:15 1990
***************
*** 824,832 ****
--- 824,847 ----
  /*
   * Put a unique name into header.ident.
   */
+ 
+ /* This way is a little quicker */
+ 
  getident(hp)
  struct hbuf *hp;
  {
+ 
+   (void) sprintf(hp->ident,"<%d.%d@%s>",time(0L),getpid(),LOCALSYSNAME);
+ 
+ }
+ 
+ /*
+ 
+ This is the old way
+ 
+ getident(hp)
+ struct hbuf *hp;
+ {
  	long seqn;
  	register FILE *fp;
  	extern char *mydomain();
***************
*** 838,844 ****
  	seqn = atol(bfr) + 1;
  /*
   * For Eunice, this breaks if SEQFILE is not in Unix format.
!  */
  	fp = xfopen(SEQFILE, "r+w");
  	fprintf(fp, "%ld\n", seqn);
  	(void) fclose(fp);
--- 853,859 ----
  	seqn = atol(bfr) + 1;
  /*
   * For Eunice, this breaks if SEQFILE is not in Unix format.
!  * /
  	fp = xfopen(SEQFILE, "r+w");
  	fprintf(fp, "%ld\n", seqn);
  	(void) fclose(fp);
***************
*** 845,850 ****
--- 860,867 ----
  	unlock();
  	(void) sprintf(hp->ident, "<%ld@%s>", seqn, LOCALSYSNAME);
  }
+ 
+ */
  
  /*
   * Check that header.nbuf contains only valid newsgroup names;
-- 
Nick Sayer               |  Disclaimer:
N6QQQ                    |    "Just because you're reading my post doesn't
mrapple@quack.sac.ca.us  |     mean we're gonna take long showers together."
209-952-5347 (Telebit)   |                      -- Gunnery Sgt. Thomas Highway
Technical Details
Message-ID: <651649817.25609@quack.sac.ca.us>
Path: arc1-ca.pugleaf.net!utzoo!utstat!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!mips!decwrl!csus.edu!ucdavis!uop!quack!mrapple

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utstat!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!mips!decwrl!csus.edu!ucdavis!uop!quack!mrapple
From: mrapple@quack.sac.ca.us (Nick Sayer)
Newsgroups: news.software.b
Subject: B-news inews patch to Message-ID line
Summary: makes id <[ctime].[pid]@[sysname]>
Message-ID: <651649817.25609@quack.sac.ca.us>
Date: 26 Aug 90 05:50:18 GMT
Organization: The Duck Pond, Stockton, CA
Lines: 85