diff options
author | jraynard <jraynard@FreeBSD.org> | 1997-11-14 07:14:58 +0800 |
---|---|---|
committer | jraynard <jraynard@FreeBSD.org> | 1997-11-14 07:14:58 +0800 |
commit | 75db8e37990bbcf59ddfff3a63f8d43b91fa2247 (patch) | |
tree | e2510edd6901d195a42ed1a033bc2e5edf78a858 /news | |
parent | c0acfb22f9f6e4abad899c6a262f2cd269be2596 (diff) | |
download | freebsd-ports-gnome-75db8e37990bbcf59ddfff3a63f8d43b91fa2247.tar.gz freebsd-ports-gnome-75db8e37990bbcf59ddfff3a63f8d43b91fa2247.tar.zst freebsd-ports-gnome-75db8e37990bbcf59ddfff3a63f8d43b91fa2247.zip |
Add site exclusions patches. Some cleanup.
Diffstat (limited to 'news')
-rw-r--r-- | news/slurp/Makefile | 16 | ||||
-rw-r--r-- | news/slurp/distinfo | 1 | ||||
-rw-r--r-- | news/slurp/files/patch-aa | 20 | ||||
-rw-r--r-- | news/slurp/files/patch-ab | 29 | ||||
-rw-r--r-- | news/slurp/files/patch-ac | 23 | ||||
-rw-r--r-- | news/slurp/files/patch-ad | 38 | ||||
-rw-r--r-- | news/slurp/files/patch-ae | 21 | ||||
-rw-r--r-- | news/slurp/files/patch-af | 57 | ||||
-rw-r--r-- | news/slurp/files/patch-ag | 12 | ||||
-rw-r--r-- | news/slurp/files/siteexclude.c | 168 | ||||
-rw-r--r-- | news/slurp/pkg-descr | 7 | ||||
-rw-r--r-- | news/slurp/scripts/configure | 20 |
12 files changed, 385 insertions, 27 deletions
diff --git a/news/slurp/Makefile b/news/slurp/Makefile index a50b074c5143..43ba06b2bb1c 100644 --- a/news/slurp/Makefile +++ b/news/slurp/Makefile @@ -3,7 +3,7 @@ # Date created: 30 Jun 1996 # Whom: jraynard # -# $Id: Makefile,v 1.1.1.1 1996/07/27 21:54:11 asami Exp $ +# $Id: Makefile,v 1.2 1996/11/18 11:38:10 asami Exp $ # DISTNAME= slurp-1.10 @@ -13,21 +13,15 @@ EXTRACT_SUFX= .tar.Z MAINTAINER= jraynard@FreeBSD.ORG -#RUN_DEPENDS= ${PREFIX}/etc/innd:${PORTSDIR}/news/inn - NO_WRKSUBDIR= yes MAN1= slurp.1 -pre-build: - @(cd ${WRKSRC}; cp conf.h conf.h.orig; \ - sed -e 's!/usr/lib/news!${PREFIX}/news/lib!' -e 's!/var/spool!/var!' conf.h.orig > conf.h; \ - rm -f syslog.h) - @cp ${FILESDIR}/dbz.* ${WRKSRC} +pre-install: + ${MKDIR} ${PREFIX}/news/lib ${PREFIX}/news/bin do-install: - ${MKDIR} ${PREFIX}/news/bin ${PREFIX}/news/lib - install -c -o news -g news -m 0555 -s ${WRKSRC}/slurp ${PREFIX}/news/bin/ + ${INSTALL_PROGRAM} ${WRKSRC}/slurp ${PREFIX}/news/bin ${INSTALL_MAN} ${WRKSRC}/slurp.1 ${PREFIX}/man/man1 - install -c -o news -g news -m 0644 ${WRKSRC}/slurp.sys ${PREFIX}/news/lib/ + ${INSTALL_DATA} ${WRKSRC}/slurp.sys ${PREFIX}/news/lib .include <bsd.port.mk> diff --git a/news/slurp/distinfo b/news/slurp/distinfo index a4836125c65d..85cc27dffc8b 100644 --- a/news/slurp/distinfo +++ b/news/slurp/distinfo @@ -1 +1,2 @@ MD5 (slurp-1.10.tar.Z) = 0983ba2ecebf8ee83e36807aabf1a0b2 +MD5 (slurp.siteexclude.patch.gz) = c87c3c351c625374f6d57b3166209bd7 diff --git a/news/slurp/files/patch-aa b/news/slurp/files/patch-aa index 24d8f769c934..54089e764786 100644 --- a/news/slurp/files/patch-aa +++ b/news/slurp/files/patch-aa @@ -1,5 +1,5 @@ --- Makefile.orig Tue Feb 7 12:37:45 1995 -+++ Makefile Sat Jun 29 23:13:53 1996 ++++ Makefile Sun Nov 9 18:14:24 1997 @@ -15,10 +15,10 @@ # appropriate header file and library for the news database format that # you have chosen. @@ -14,16 +14,20 @@ #DBLIB = -ldbz #DBINCLUDE = -I/usr/local/include -@@ -28,7 +28,7 @@ +@@ -28,7 +28,11 @@ # C compilation flags # Add here any additional compilation flags you need. -CFLAGS = -O -+#CFLAGS = -O ++# To enable the site exclusion features, define SITEEXCLUDING. ++# ++# 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 -@@ -41,8 +41,8 @@ +@@ -41,8 +45,8 @@ # On some systems (e.g. SVR4) you need to include additional socket # libraries. On others (e.g. Linux, BSD) this is not required. @@ -34,16 +38,16 @@ # If you don't have the syslog facility then uncomment these two lines -@@ -54,15 +54,16 @@ +@@ -54,15 +58,16 @@ # 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 space.c $(FAKESRC) -+ dbz.c cache.c hostfiles.c space.c $(FAKESRC) ++ 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 \ - cache.o hostfiles.o space.o $(FAKEOBJ) -+ dbz.o cache.o hostfiles.o space.o $(FAKEOBJ) ++ 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 \ @@ -53,7 +57,7 @@ slurp: $(OBJECT) $(CC) $(LDFLAGS) $(OBJECT) -o slurp $(DBLIB) $(LIBS) -@@ -71,17 +72,17 @@ +@@ -71,17 +76,17 @@ $(CC) $(CFLAGS) $(DBINCLUDE) -c $< diff --git a/news/slurp/files/patch-ab b/news/slurp/files/patch-ab index 8faeeb25bcfd..492c05683c60 100644 --- a/news/slurp/files/patch-ab +++ b/news/slurp/files/patch-ab @@ -1,11 +1,24 @@ ---- conf.h.orig Sat Jun 29 23:29:13 1996 -+++ conf.h Sat Jun 29 23:29:25 1996 -@@ -155,7 +155,7 @@ - undefined. If the required define is not supplied by the compiler - (e.g. SVR4, SVR3) then you will need to include it yourself here. */ +--- articles.c.orig Sun Nov 9 18:14:49 1997 ++++ articles.c Sun Nov 9 18:16:40 1997 +@@ -348,6 +348,10 @@ + case OK_ARTICLE: + fetch_article (); + xfrart++; ++#ifdef KEEPMISSINGARTS ++ /* Note that this article has been retrieved and filed */ ++ idnode -> used = TRUE; ++#endif /* KEEPMISSINGARTS */ + break; --#define SVR4 -+/* #define SVR4 */ + /* Otherwise must be a protocol error */ +@@ -358,8 +362,10 @@ + exit (4); + } ++#ifndef KEEPMISSINGARTS + /* Note that this article has been retrieved and filed */ + idnode -> used = TRUE; ++#endif /* KEEPMISSINGARTS */ - /* The facility name which syslog reports errors and stats under. If + /* Print progress if required */ + if (progress_flag) diff --git a/news/slurp/files/patch-ac b/news/slurp/files/patch-ac new file mode 100644 index 000000000000..e5d5fbfa40e9 --- /dev/null +++ b/news/slurp/files/patch-ac @@ -0,0 +1,23 @@ +--- conf.h.orig Tue Feb 7 14:29:19 1995 ++++ conf.h Sun Nov 9 18:13:56 1997 +@@ -57,6 +57,11 @@ + #define SYSFILE "/usr/lib/news/slurp.sys" + #define HOSTFILE "/usr/lib/news/slurp." + ++/* These files will be used by the site exclusion feature. SITEFILE ++ is a list of sites that you do not wish to receive articles from. ++ The IDs of articles thus rejected will be kept in DROPFILE. */ ++#define SITEFILE "/usr/lib/news/excludesites" ++#define DROPFILE "/usr/lib/news/exclarticles" + + /* Speedup sets the number of extra ARTICLE requests that are stacked + up at the NNTP server awaiting transmission - aka pipelining. +@@ -155,7 +160,7 @@ + undefined. If the required define is not supplied by the compiler + (e.g. SVR4, SVR3) then you will need to include it yourself here. */ + +-#define SVR4 ++/* #define SVR4 */ + + + /* The facility name which syslog reports errors and stats under. If diff --git a/news/slurp/files/patch-ad b/news/slurp/files/patch-ad new file mode 100644 index 000000000000..ee108d18d11f --- /dev/null +++ b/news/slurp/files/patch-ad @@ -0,0 +1,38 @@ +--- newnews.c.orig Sun Nov 9 18:17:14 1997 ++++ newnews.c Sun Nov 9 18:19:29 1997 +@@ -158,10 +158,16 @@ + process_id (char *msgid) + { + char *cp; ++#ifdef SITEEXCLUDING ++ char *host; ++#endif /*SITEXCLUDING*/ + + /* Modify the message id appropriate to C-News history files */ + if ((cp = strchr (msgid, '@')) != NULL) + { ++#ifdef SITEEXCLUDING ++ host = cp; ++#endif /*SITEXCLUDING*/ + for (; *cp != '\0'; cp++) + if (isupper (*cp)) + *cp = tolower (*cp); +@@ -169,6 +175,18 @@ + + if (debug_flag) + (void) fprintf (stderr, "-> %s", msgid); ++ ++#ifdef SITEEXCLUDING ++ if((host)&&(site_check(host))) ++ { ++ if (debug_flag) ++ (void) fprintf (stderr, " (Excluded host %s)", host); ++ /* Excluded host */ ++ site_droparticle(msgid); ++ exclart++; ++ return; ++ } ++#endif /*SITEXCLUDING*/ + + /* If hit maximum cache size, then store in a temporary file */ + #ifdef MAXCACHE diff --git a/news/slurp/files/patch-ae b/news/slurp/files/patch-ae new file mode 100644 index 000000000000..9d2448736977 --- /dev/null +++ b/news/slurp/files/patch-ae @@ -0,0 +1,21 @@ +--- patchlevel.h.orig Sun Nov 9 18:19:34 1997 ++++ patchlevel.h Sun Nov 9 18:20:34 1997 +@@ -9,6 +9,10 @@ + * $Id: patchlevel.h,v 1.10 1995/02/07 14:33:25 root Exp root $ + * + * $Log: patchlevel.h,v $ ++ * ++ * 1.10.pf.b - Add siteexclusion stuff ++ * 1.10.pf.a - Save missing article ids, to try later ++ * + * Revision 1.10 1995/02/07 14:33:25 root + * Updated for new version + * +@@ -18,6 +22,6 @@ + * + */ + +-#define PATCHLEVEL "1.10" ++#define PATCHLEVEL "1.10.pf.b" + + /* END-OF-FILE */ diff --git a/news/slurp/files/patch-af b/news/slurp/files/patch-af new file mode 100644 index 000000000000..19c220e848e5 --- /dev/null +++ b/news/slurp/files/patch-af @@ -0,0 +1,57 @@ +--- slurp.c.orig Sun Nov 9 18:20:54 1997 ++++ slurp.c Sun Nov 9 18:25:16 1997 +@@ -151,6 +151,9 @@ + int waiting = 0; + int dupart = 0; + int misart = 0; ++#ifdef SITEEXCLUDING ++int exclart = 0; ++#endif /* SITEEXCLUDING */ + int xfrart = 0; + long totalsize = 0; + +@@ -627,6 +630,11 @@ + if (open_history ()) + log_sys ("can't open history file %s", HISTORY_FILE); + ++#ifdef SITEEXCLUDING ++ /* Get site names to exclude */ ++ site_init(); ++#endif /* SITEEXCLUDING */ ++ + /* Load start time or ids from hostfile if appropriate */ + read_hostfile (); + +@@ -697,6 +705,9 @@ + /* Time to say goodbye */ + close_server (); + close_history (); ++#ifdef SITEEXCLUDING ++ site_close(); ++#endif /* SITEEXCLUDING */ + + /* Submit the remaining batch, if present */ + enqueue_batch (); +@@ -706,12 +717,22 @@ + + #ifdef SYSLOG + if (!debug_flag) ++#ifdef SITEEXCLUDING ++ syslog (LOG_INFO, "Processed %d new, %d duplicate, %d missing, %d excluded articles", ++ xfrart, dupart, misart, exclart); ++#else + syslog (LOG_INFO, "Processed %d new, %d duplicate, %d missing articles", + xfrart, dupart, misart); ++#endif /* SITEEXCLUDING */ + else + #endif ++#ifdef SITEEXCLUDING ++ (void) fprintf (stderr, "Processed %d new, %d duplicate, %d missing, %d excluded articles\n", ++ xfrart, dupart, misart, exclart); ++#else + (void) fprintf (stderr, "Processed %d new, %d duplicate, %d missing articles\n", + xfrart, dupart, misart); ++#endif /* SITEEXCLUDING */ + + #ifdef SPEEDSTATS + #ifdef SYSLOG diff --git a/news/slurp/files/patch-ag b/news/slurp/files/patch-ag new file mode 100644 index 000000000000..864ed21d2510 --- /dev/null +++ b/news/slurp/files/patch-ag @@ -0,0 +1,12 @@ +--- slurp.h.orig Sun Nov 9 18:25:22 1997 ++++ slurp.h Sun Nov 9 18:26:04 1997 +@@ -97,6 +97,9 @@ + extern int dupart; /* Number of duplicate articles */ + extern int misart; /* Number of missing articles */ + extern int xfrart; /* Number of transferred articles */ ++#ifdef SITEEXCLUDING ++extern int exclart; /* Number of excluded articles */ ++#endif /* SITEEXCLUDING */ + extern long totalsize; /* Total size of articles tranferred */ + + /* Misc variables */ diff --git a/news/slurp/files/siteexclude.c b/news/slurp/files/siteexclude.c new file mode 100644 index 000000000000..67e4aaa05616 --- /dev/null +++ b/news/slurp/files/siteexclude.c @@ -0,0 +1,168 @@ +/* siteexclude.c - check article id for excluded sites + * + * Copyright (C) 1995 Peter Fox <fox@roestock.demon.co.uk> + * + * This code may be freely copied in it's entirety, but the + * above notice may not be removed or altered without + * reference to the author. + * Individuals may make changes for their own use, however + * any changed copies may not be distributed without + * reference to the author. + * There isn't any guarantee of usefulness or efficacy for + * any particular purpose. Take it as it is. + */ +#include <stdio.h> +#include <string.h> +#include "syslog.h" +#include "conf.h" + +#ifdef TEST +#define SITEEXCLUDING +#endif /*TEST*/ + +#ifdef SITEEXCLUDING +typedef struct slist +{ + struct slist *next; + char *str; +} SLIST, *SLISTPTR; + +#define HASHSIZE 256 +#define HASHFN(x) (((x[1] & 15) << 4)|(x[2] & 15)) /* x is (char *), skip '@' */ + +#ifdef TEST +#define SITEFILE "./sites" +#define DROPFILE "./dropped" +#define log_msg printf +#define log_sys printf +#define debug_flag 1 +#else /*!TEST*/ +extern int debug_flag; +#ifndef SITEFILE +#define SITEFILE "/var/lib/news/excludesites" +#endif /*SITEFILE*/ +#ifndef DROPFILE +#define DROPFILE "/var/lib/news/droppedarticles" +#endif /*DROPFILE*/ +#endif /*TEST*/ + +SLIST hash[HASHSIZE]; + +static FILE *dropfp = (FILE*)0; + +site_init() +{ + int i; + FILE *fp; + char linbuf[BUFSIZ]; + SLISTPTR ptr; + int entries, collisions; + entries = 0; + collisions = 0; + for(i = 0; i < HASHSIZE; i++) + { + hash[i].next = (SLISTPTR)0; + hash[i].str = (char *)0; + } + if(!(fp = fopen(SITEFILE, "r"))) + { + log_msg("site_init: warning - no site exclude file %s", SITEFILE); + return; + } + if(!(dropfp = fopen(DROPFILE, "a"))) + { + log_msg("site_init: warning - cannot open file %s for append, dropped articles logged instead", DROPFILE); + } + else + fprintf(dropfp, "-----\n"); + /* File contains lines with complete site names to exclude */ + /* We add the leading @ and trailing > */ + linbuf[0] = '@'; + while(1) + { + /* Read in a line */ + (void) fgets(linbuf+1, sizeof (linbuf)-2, fp); + if(feof(fp)) + break; + /* If a read error then report it and abort */ + if (ferror(fp)) + { + log_sys("site_init: error reading %s", SITEFILE); + break; + } + if(linbuf[1]) + { + /* Kill the \n */ + linbuf[strlen(linbuf)-1] = '>'; + entries++; + ptr = &hash[HASHFN(linbuf)]; + if(debug_flag) + fprintf(stderr, "'%s: %08lx'\n", linbuf, ptr); + if(!ptr->str) + ptr->str = strdup(linbuf); + else + { + /* Run along to the last in line */ + while(ptr->next) + ptr = ptr->next; + ptr->next = (SLISTPTR)malloc(sizeof(SLIST)); + ptr = ptr->next; + ptr->next = (SLISTPTR)0; + ptr->str = strdup(linbuf); + collisions++; + } + } + } + fclose(fp); + if(debug_flag) + log_msg("site_init: site exclude file %s read: %d entries, %d collisions", + SITEFILE, entries, collisions); +} + +site_check(char *site) +{ + SLISTPTR ptr; + ptr = &hash[HASHFN(site)]; + if(debug_flag) + fprintf(stderr, " '%s: %08lx'", site, ptr); + if(!ptr->str) + return(0); + while(ptr) + { + if(strcmp(site, ptr->str) == 0) + return(1); + ptr = ptr->next; + } + return(0); +} + +site_droparticle(char *id) +{ + if(dropfp) + fprintf(dropfp, "%s\n", id); + else + log_msg("Excluded article: %s", id); +} + +site_close() +{ + if(dropfp) + fclose(dropfp); +} + +#ifdef TEST +main(int argc, char **argv) +{ + site_init(); + argv++; + argc--; + while(argc--) + { + if(site_check(*argv)) + printf("Found %s\n", *argv); + argv++; + } + return(0); +} +#endif /*TEST*/ +#endif /* SITEEXCLUDING */ diff --git a/news/slurp/pkg-descr b/news/slurp/pkg-descr index 0be45cf51b70..99cea3678f30 100644 --- a/news/slurp/pkg-descr +++ b/news/slurp/pkg-descr @@ -6,3 +6,10 @@ forwarding on via UUCP to another news system. It replaces nntpxfer from the NNTP 1.5.12 reference implementation and nntpget from the INN distribution. +Patches from Peter Fox (fox@roestock.demon.co.uk) have been added to +avoid downloading articles from certain sites. To make use of this +facility, create a file ${PREFIX}/news/lib/excludesites and list the +sites in it, eg + +fritter.spam.com +lusers.org diff --git a/news/slurp/scripts/configure b/news/slurp/scripts/configure new file mode 100644 index 000000000000..894bc907041a --- /dev/null +++ b/news/slurp/scripts/configure @@ -0,0 +1,20 @@ +#!/bin/sh +# +# $Id$ +# + +echo "s!/usr/lib/news!${PREFIX}/news/lib!" > ${TMPDIR}/tmp.slurp.sed.$$ + +if [ -d /var/news ] +then + echo 's!/var/spool!/var!' >> ${TMPDIR}/tmp.slurp.sed.$$ +fi + +sed -f ${TMPDIR}/tmp.slurp.sed.$$ < ${WRKSRC}/conf.h > ${WRKSRC}/conf.h.tmp +mv ${WRKSRC}/conf.h.tmp ${WRKSRC}/conf.h +rm -f ${TMPDIR}/tmp.slurp.sed.$$ + +rm -f ${WRKDIR}/syslog.h + +cp ${FILESDIR}/dbz.* ${WRKSRC} +cp ${FILESDIR}/siteexclude.c ${WRKSRC} |