Thread View: news.software.nntp
1 messages
1 total messages
Started by Eilon Gishri
Mon, 10 Feb 1997 00:00
patch to nnrpd
Author: Eilon Gishri
Date: Mon, 10 Feb 1997 00:00
Date: Mon, 10 Feb 1997 00:00
99 lines
3582 bytes
3582 bytes
Hi,
I've made a small patch to nnrpd against one with the following patch
already applied: nnrpd-mmap-shared-active.patch. The idea is to be able to:
A. Block clients from crossposting to more than X groups.
B. To get the amount of data transferred to the clients.
Shoot me if I made a mistake :)
diff -u --recursive --new-file nnrpd.old/nnrpd.c nnrpd/nnrpd.c
--- nnrpd.old/nnrpd.c Tue Dec 17 16:40:40 1996
+++ nnrpd/nnrpd.c Mon Feb 10 23:42:38 1997
@@ -150,8 +150,8 @@
}
GRPreport();
- syslog(L_NOTICE, "%s exit articles %ld groups %ld",
- ClientHost, ARTcount, GRPcount);
+ syslog(L_NOTICE, "%s exit articles %ld groups %ld bytes %ld",
+ ClientHost, ARTcount, GRPcount, BYTEcount);
if (POSTreceived || POSTrejected)
syslog(L_NOTICE, "%s posts received %ld rejected %ld",
ClientHost, POSTreceived, POSTrejected);
@@ -486,7 +486,7 @@
#endif /* defined(VAR_VARARGS) */
START_VARARG(fmt, vp, char*);
- (void)vprintf(fmt, vp);
+ BYTEcount += (int)vprintf(fmt, vp);
va_end(vp);
if (Tracing) {
diff -u --recursive --new-file nnrpd.old/nnrpd.h nnrpd/nnrpd.h
--- nnrpd.old/nnrpd.h Thu Feb 6 23:23:02 1997
+++ nnrpd/nnrpd.h Mon Feb 10 23:42:24 1997
@@ -39,9 +39,9 @@
** Some convenient shorthands.
*/
typedef struct in_addr INADDR;
-#define Printf (void)printf
+#define Printf BYTEcount += (int)printf
#if defined(VAR_NONE)
-#define Reply (void)printf
+#define Reply BYTEcount += (int)printf
#endif /* defined(VAR_NONE) */
@@ -111,6 +111,7 @@
EXTERN int ARTsize;
extern int PERMdefault;
EXTERN long ARTcount;
+EXTERN long BYTEcount;
EXTERN long GRParticles;
EXTERN long GRPcount;
EXTERN char GRPlast[SPOOLNAMEBUFF];
diff -u --recursive --new-file nnrpd.old/post.c nnrpd/post.c
--- nnrpd.old/post.c Thu Feb 6 23:23:02 1997
+++ nnrpd/post.c Mon Feb 10 23:34:15 1997
@@ -567,6 +567,7 @@
char *grplist[2];
BOOL IsNewgroup;
BOOL FoundOne;
+ int GroupCount;
p = HDR(_control);
IsNewgroup = p && EQn(p, "newgroup", 8);
@@ -588,6 +589,7 @@
if ((gp = GRPfind(p)) == NULL)
continue;
FoundOne = TRUE;
+ GroupCount++;
DDcheck(h, p);
switch (GPFLAG(gp)) {
case NF_FLAG_OK:
@@ -622,6 +624,16 @@
}
} while ((p = strtok((char *)NULL, NGSEPS)) != NULL);
DISPOSE(groups);
+
+ if (Tracing)
+ syslog(L_NOTICE, "%s crossposting article to %d newsgroups",
+ ClientHost, GroupCount);
+#ifdef LOCAL_MAX_CROSSPOST
+ if ( GroupCount > LOCAL_MAX_CROSSPOST )
+ (void)sprintf(Error,
+ "Crossposting to %d newsgroups while the limit is %d!",
+ GroupCount, LOCAL_MAX_CROSSPOST);
+#endif
if (!FoundOne && !IsNewgroup)
(void)sprintf(Error, "No valid newsgroups in \"%s\"", hdr);
--
Eilon Gishri, Tel-Aviv University Computation Center
Home 03-5078671 /* on a matter of national security */
E-mail: eilon@aristo.tau.ac.il
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads