Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Feb 2000 08:26:10 +0000
From:      Geraint A Edwards <gedge@serf.org>
To:        ports@freebsd.org
Subject:   [gedge: Re: y2k bugfix - slurp Linux/Unix USENET]
Message-ID:  <20000223082610.A79454@serf.org>

next in thread | raw e-mail | index | archive | help
Just posted this, and thought it may be useful for the
FreeBSD slurp port.

----- Forwarded message from gedge -----

Newsgroups: demon.ip.support.unix
Subject: Re: y2k bugfix - slurp Linux/Unix USENET
Summary: 
Expires: 
Followup-To: 
Reply-To: gedge@serf.org
Distribution: 
Organization: (posting from Cardiff, Wales)
Keywords: 
Cc: 

James R Grinter <jrg@blodwen.demon.co.uk> wrote:
> Has anyone made the modifications to history.c for a version 2 INN dbz
> file?

Well, I have got it to work on my machine - see patch below.
It's ugly and probably not portable, but it works for me. :-)
Absolutely no warranty is offered.

I am running the following:
	FreeBSD 3.4, INN 2.2.2 and slurp 1.10 + 'exclude' patches.
It requires the INN object files, so you'll need those handy.
I've tried to control the mods by defining INN2, but I have not
tested it without.

I would also suggest putting the dot in the following line in conf.h
	#define BATCHNAME    ".nntp.XXXXXX"
as I think any cron runs of 'rnews -U' acts on (and hence breaks)
slurp's default temp. batches "nntp.XXXXXX".

Comments welcome.



diff -c Makefile.orig Makefile
*** Makefile.orig	Tue Feb 22 19:34:45 2000
--- Makefile	Sat Feb  5 13:49:47 2000
***************
*** 15,24 ****
  #   appropriate header file and library for the news database format that
  #   you have chosen.
  
  #DBINCLUDE = -I/usr/local/src/cnews/dbz
  #DBLIB = /usr/local/src/cnews/dbz/dbz.o
  
! DBINCLUDE = -I .
  #DBLIB = -ldbz
  
  #DBINCLUDE = -I/usr/local/include
--- 15,27 ----
  #   appropriate header file and library for the news database format that
  #   you have chosen.
  
+ 
  #DBINCLUDE = -I/usr/local/src/cnews/dbz
+ DBINCLUDE = -I. -I../inn-2.2.2/include
+ DBLIB = ../inn-2.2.2/lib/dbz.o ../inn-2.2.2/lib/hash.o ../inn-2.2.2/lib/reservedfd.o ../inn-2.2.2/lib/closeonexec.o ../inn-2.2.2/lib/nonblocking.o ../inn-2.2.2/lib/getconfig.o ../inn-2.2.2/lib/xmalloc.o ../inn-2.2.2/lib/md5.o ../inn-2.2.2/lib/xrealloc.o ../inn-2.2.2/lib/getfqdn.o ../inn-2.2.2/lib/xmemerr.o
  #DBLIB = /usr/local/src/cnews/dbz/dbz.o
  
! #DBINCLUDE = -I .
  #DBLIB = -ldbz
  
  #DBINCLUDE = -I/usr/local/include
***************
*** 33,39 ****
  # If KEEPMISSINGARTS is defined, slurp will attempt on the next run
  # to fetch articles which were not available on the current download.
  CFLAGS+=-DSITEEXCLUDING -DKEEPMISSINGARTS
! 
  
  # Loader flags
  #   Add here any additional loader flags you need.
--- 36,42 ----
  # If KEEPMISSINGARTS is defined, slurp will attempt on the next run
  # to fetch articles which were not available on the current download.
  CFLAGS+=-DSITEEXCLUDING -DKEEPMISSINGARTS
! # -DDONT_TAGGED_HASH
  
  # Loader flags
  #   Add here any additional loader flags you need.
***************
*** 58,67 ****
  # Everything else probably doesn't need changing
  
  SOURCE = slurp.c newnews.c articles.c history.c time.c sockets.c misc.c \
! 	 dbz.c cache.c hostfiles.c siteexclude.c space.c $(FAKESRC)
  
  OBJECT = slurp.o newnews.o articles.o history.o time.o sockets.o misc.o \
! 	 dbz.o cache.o hostfiles.o siteexclude.o space.o $(FAKEOBJ)
  
  MANIFEST = README slurp.c newnews.c articles.c history.c time.c sockets.c \
  	   misc.c cache.c hostfiles.c space.c fakesyslog.c conf.h slurp.h \
--- 61,70 ----
  # Everything else probably doesn't need changing
  
  SOURCE = slurp.c newnews.c articles.c history.c time.c sockets.c misc.c \
! 	 cache.c hostfiles.c siteexclude.c space.c $(FAKESRC)
  
  OBJECT = slurp.o newnews.o articles.o history.o time.o sockets.o misc.o \
! 	 cache.o hostfiles.o siteexclude.o space.o $(FAKEOBJ)
  
  MANIFEST = README slurp.c newnews.c articles.c history.c time.c sockets.c \
  	   misc.c cache.c hostfiles.c space.c fakesyslog.c conf.h slurp.h \
diff -c conf.h.orig conf.h
*** conf.h.orig	Tue Feb 22 19:34:46 2000
--- conf.h	Sat Feb  5 13:14:56 2000
***************
*** 45,50 ****
--- 45,65 ----
   * Initial coding.
   */
  
+ #define INN2
+ #ifdef INN2
+ #include <configdata.h>
+ #include <stdio.h>
+ #include <clibrary.h>
+ #include <libinn.h>
+ /*
+ 	typedef int BOOL;
+ 	typedef long OFFSET_T;
+ 	typedef struct {
+   		char  hash[16];
+ 	} HASH;
+ */
+ #endif
+ 
  
  /* SLURP CONFIGURATION
     =================== */
diff -c history.c.orig history.c
*** history.c.orig	Tue Jan 10 12:54:13 1995
--- history.c	Sat Feb 19 21:47:25 2000
***************
*** 79,85 ****
--- 79,89 ----
  open_history ()
  	{
  #if defined (DBM) || defined (DBZ)
+ #ifdef INN2
+ 	if (!dbzinit (HISTORY_FILE))
+ #else
  	if (dbminit (HISTORY_FILE) < 0)
+ #endif
  		return (1);
  #elif defined (GDBM)
  	if ((db = gdbm_open (HISTORY_FILE, 4096, GDBM_READER, 0, 0)) == NULL)
***************
*** 101,107 ****
--- 105,113 ----
  close_history ()
  	{
  #if defined (DBM) || defined (DBZ)
+ #ifndef INN2
  	(void) dbmclose ();
+ #endif
  #elif defined (GDBM) 
  	gdbm_close (db);
  #elif defined (NDBM)
***************
*** 118,137 ****
  check_id (const char *message_id)
  	{
  #if defined (DBM) || defined (DBZ) || defined (GDBM) || defined (NDBM)
! 	datum k, d;
  
  /* Now check for presence with dbm/ndbm */
  
  	k.dptr = (char *) message_id;
  	k.dsize = strlen (message_id) + 1;
  
- 	if (no_history_flag)
- 		return (TRUE);
  #endif
  
  #if defined (DBM) || defined (DBZ)
  	d = fetch (k);
  	return (d.dptr == NULL);
  #elif defined (GDBM)
  	d = gdbm_fetch (db, k);
  	return (d.dptr == NULL);
--- 124,150 ----
  check_id (const char *message_id)
  	{
  #if defined (DBM) || defined (DBZ) || defined (GDBM) || defined (NDBM)
! 	if (no_history_flag)
! 		return (TRUE);
  
  /* Now check for presence with dbm/ndbm */
  
+ #if defined(INN2)
+ 	return (NULL == dbzexists(HashMessageID(message_id)));
+ #else
+ 	datum k, d;
+ 
  	k.dptr = (char *) message_id;
  	k.dsize = strlen (message_id) + 1;
+ #endif
  
  #endif
  
  #if defined (DBM) || defined (DBZ)
+ #ifndef INN2
  	d = fetch (k);
  	return (d.dptr == NULL);
+ #endif
  #elif defined (GDBM)
  	d = gdbm_fetch (db, k);
  	return (d.dptr == NULL);
diff -c slurp.c.orig slurp.c
*** slurp.c.orig	Tue Feb 22 19:34:46 2000
--- slurp.c	Sat Feb  5 13:24:38 2000
***************
*** 662,668 ****
--- 662,672 ----
  		}
  
  	/* Set up the connection to the server */
+ #ifdef INN2
+ 	switch (ret = slurp_server_init (hostname, portno))
+ #else
  	switch (ret = server_init (hostname, portno))
+ #endif
  		{
  		case -1 :
  			exit (3);
diff -c slurp.h.orig slurp.h
*** slurp.h.orig	Tue Feb 22 19:34:46 2000
--- slurp.h	Sat Feb  5 13:16:29 2000
***************
*** 133,139 ****
--- 133,143 ----
  extern void process_id (char *);
  
  extern int tcp_open (const char *, const char *, const int);
+ #ifdef INN2
+ extern int slurp_server_init (const char *, const int);	/* sockets.c */
+ #else
  extern int server_init (const char *, const int);	/* sockets.c */
+ #endif
  extern void close_server (void);
  extern void get_server (char *, const int);
  extern void put_server (const char *);
diff -c sockets.c.orig sockets.c
*** sockets.c.orig	Tue Jan 10 13:10:54 1995
--- sockets.c	Sat Feb  5 13:16:53 2000
***************
*** 179,185 ****
--- 179,189 ----
   */
  
  	int
+ #ifdef INN2
+ slurp_server_init (const char *hostname, const int portno)
+ #else
  server_init (const char *hostname, const int portno)
+ #endif
  	{
  	char line [NNTP_STRLEN];
  	int server_rd_fd;
diff -c syslog.h.orig syslog.h
*** syslog.h.orig	Tue Nov 29 20:28:00 1994
--- syslog.h	Sat Feb  5 08:43:18 2000
***************
*** 64,69 ****
  #define LOG_NOWAIT	0
  
  #else
! #include <syslog.h>
  #endif
  #endif
--- 64,70 ----
  #define LOG_NOWAIT	0
  
  #else
! /* #include <syslog.h> */
! #include "/usr/include/syslog.h"
  #endif
  #endif






----- End forwarded message -----

-- 
"Gedge"           Geraint A. Edwards       gedge@inner.demon.co.uk
Caerdydd, Cymru   http://serf.org/gedge/   gedge@serf.org    IRCNet:Gedge


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000223082610.A79454>