trn, nntpcache and groups being reset.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I finally got sufficiently fed up with trn complaining about groups being
reset that I tracked the problem down and fixed it.

Here's what was happening.

If you have a group that currently has no articles in it and you talk directly
to an INN you get the following:

bats% telnet news.wlg.netlink.net.nz 119
Trying 203.97.132.188...
Connected to news.wlg.netlink.net.nz.
Escape character is '^]'.
200 news.wlg.netlink.net.nz InterNetNews NNRP server INN 1.7.2 08-Dec-1997 ready (posting ok).
list active biz.dec.ip
215 list:
biz.dec.ip 397 398 y
.
group biz.dec.ip
211 0 0 0 biz.dec.ip
list active biz.dec.ip
215 list:
biz.dec.ip 397 398 y
.
quit
205 .
Connection closed by foreign host.


If you do the same to nntpcache you get:

bats% telnet news 119
Trying 130.195.5.13...
Connected to bats.mcs.vuw.ac.nz.
Escape character is '^]'.
200 bats.mcs.vuw.ac.nz NNTPcache server V2.3.2.1 [see www.nntpcache.org] (c) 1996-1998 Julian Assange <proff@iq.org> Mar 26 1998 ready (posting ok).
list active biz.dec.ip
215
biz.dec.ip 397 398 y
.
group biz.dec.ip
211 0 0 0 biz.dec.ip
list active biz.dec.ip
215
biz.dec.ip 0 0 y
.


nntpcache believes and updates the hi and lo counters for the newsgroup based
on the result of the group command even when that command says there are 0 
articles in the newsgroup (and therefore the hi and lo values are undefined 
according to rfc977 and INN certainly always returns 0 and 0 in this case).


The following patch fixes this:

--- group.c~	Sat Jan 31 22:31:55 1998
+++ group.c	Thu Mar 26 00:43:55 1998
@@ -135,9 +135,16 @@
 	return setGroupDir (CurrentGroup, CurrentGroupScfg);
 }
 
-EXPORT void setGroup (struct newsgroup *n, int cnt, int lo, int hi)
+EXPORT int setGroup (struct newsgroup *n, int cnt, int lo, int hi)
 {
 	bool f_changed = FALSE;
+	if (n->msgs != cnt)
+	{
+		n->msgs = cnt;
+		f_changed = TRUE;
+	}
+	if (cnt != 0)
+	{
 	if (n->lo_server != lo)
 	{
 		n->lo_server = lo;
@@ -148,14 +155,11 @@
 		n->hi_server = hi;
 		f_changed = TRUE;
 	}
-	if (n->msgs != cnt)
-	{
-		n->msgs = cnt;
-		f_changed = TRUE;
 	}
 	n->group_time = time(NULL);
 	if (f_changed)
 		n->group_change_time = n->group_time;
+	return n->lo_server;
 }
 
 /*
@@ -187,7 +191,7 @@
 	{
 		if (newsgroupLockWrite(n))
 		{
-			setGroup(n, msgs, lo, hi);
+			lo = setGroup(n, msgs, lo, hi);
 			n->write_locks = 0;
 		}
 		scfg->artno = lo;



cheers
mark


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux