mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-26 05:02:18 +00:00
Add site exclusions patches. Some cleanup.
This commit is contained in:
parent
cf71d19180
commit
450506ee5f
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=8606
@ -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>
|
||||
|
@ -1 +1,2 @@
|
||||
MD5 (slurp-1.10.tar.Z) = 0983ba2ecebf8ee83e36807aabf1a0b2
|
||||
MD5 (slurp.siteexclude.patch.gz) = c87c3c351c625374f6d57b3166209bd7
|
||||
|
@ -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 $<
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
23
news/slurp/files/patch-ac
Normal file
23
news/slurp/files/patch-ac
Normal file
@ -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
|
38
news/slurp/files/patch-ad
Normal file
38
news/slurp/files/patch-ad
Normal file
@ -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
|
21
news/slurp/files/patch-ae
Normal file
21
news/slurp/files/patch-ae
Normal file
@ -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 */
|
57
news/slurp/files/patch-af
Normal file
57
news/slurp/files/patch-af
Normal file
@ -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
|
12
news/slurp/files/patch-ag
Normal file
12
news/slurp/files/patch-ag
Normal file
@ -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 */
|
168
news/slurp/files/siteexclude.c
Normal file
168
news/slurp/files/siteexclude.c
Normal file
@ -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 */
|
@ -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
|
||||
|
20
news/slurp/scripts/configure
vendored
Normal file
20
news/slurp/scripts/configure
vendored
Normal file
@ -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}
|
Loading…
Reference in New Issue
Block a user