Tim Krantz wrote: > > I'm curious though, exactly which version of nntpcache your patches > are to be applied against. I have been attempting to put them in > against the 92.8UL version and get some rejections. This is the version that I worked on. But since there were a couple patches in succession, there might be problems. Anyways, here is all the modifications I've done in one file against 0.92.8UL. And don't forget to purge your overview files first by find cachedir -name '*_xover' -print | xargs rm -f You can also get it via ftp://greathan.apana.org.au/pub/nntpcache/nntpcache-0.92.8UL.patch Note the memset in xover.c has been changed again. I now assume that if response / MI > min, then either response % MI == 0 or an error(s) has occured from response / MI upto response - 1. Please tell me if that is a fair assumption. -- Debian GNU/Linux 1.1 is out! { http://www.debian.org/ } Email: Herbert Xu ~{PmV>HI~} <herbert@greathan.apana.org.au> { http://greathan.apana.org.au/~herbert/ } PGP Key: pgp-public-keys@pgp.mit.edu or any other key sites -- diff -u nntpcache-current.orig/article.c nntpcache-current/article.c --- nntpcache-current.orig/article.c Thu Sep 5 12:23:48 1996 +++ nntpcache-current/article.c Sun Sep 29 11:26:54 1996 @@ -23,7 +23,7 @@ X (bool safeGroup (char *s)) { - if (strspn(s, ".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-+=") == strlen(s)) + if (strspn(s, "'.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-+=") == strlen(s)) return TRUE; logw (("group name contained suspect characters")); return FALSE; @@ -36,7 +36,7 @@ logw (("path contained ../")); return FALSE; } - if (strspn(s, ".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-/+=") != strlen(s)) + if (strspn(s, "'.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-/+=") != strlen(s)) { logw (("path contained suspect characters")); return FALSE; @@ -552,11 +552,34 @@ else sprintf (args, "body %d", artno); } + + if (!syncGroup()) + { + emitrn (NNTP_NOTINGROUP); + return FALSE; + } + Cemitrn (args); Cflush (); } } else /* not cached */ { + /* replace 'body' with 'article' unless we pulled in a _head */ + if (type == c_body) + { + + if (*msgid) + sprintf (args, "article <%.127s>", msgid); + else + sprintf (args, "article %d", artno); + } + + if (!syncGroup()) + { + emitrn (NNTP_NOTINGROUP); + return FALSE; + } + Cemitrn (args); Cflush (); } diff -u nntpcache-current.orig/group.c nntpcache-current/group.c --- nntpcache-current.orig/group.c Thu Sep 5 01:02:06 1996 +++ nntpcache-current/group.c Sun Sep 29 11:25:54 1996 @@ -156,7 +156,6 @@ } CurrentGroupArtNum = getLo(n); } -end: if (!scfg->group || !strEq(scfg->group, group)) { if (scfg->group) @@ -164,6 +163,7 @@ scfg->group = Sstrdup(group); logd (("current newsgroup now %s:%s", scfg->host, group)); } +end: CurrentScfg = CurrentGroupScfg = scfg; strcpy (CurrentGroup, group); return TRUE; @@ -367,4 +367,24 @@ #endif } } +} + +X (bool syncGroup ()) +{ + char bfr[MAX_BFR] = ""; + + if (!CurrentScfg->group || !strEq(CurrentScfg->group, CurrentGroup)) + { + Cemitf ("group %s\r\n", CurrentGroup); + Cflush (); + if (!Cget (bfr, sizeof(bfr))) return FALSE; + + if (CurrentScfg->group) free(CurrentScfg->group); + CurrentScfg->group = Sstrdup(CurrentGroup); + + logd (("current newsgroup now %s:%s", + CurrentScfg->host, CurrentGroup)); + } + + return TRUE; } diff -u nntpcache-current.orig/xover.c nntpcache-current/xover.c --- nntpcache-current.orig/xover.c Thu Sep 5 01:02:07 1996 +++ nntpcache-current/xover.c Mon Sep 30 08:40:10 1996 @@ -315,6 +315,7 @@ { free (xf->outbuf); xf->outbuf = NULL; + xf->outbuf_used = 0; } if (xf->locked) { @@ -602,7 +603,25 @@ * set failed flag in index for xover region asked. * we then knock em out one by one as xovers come in */ - memset (xf->buf+((min%MI)*4), 0xff, ((max>MI)? MI*4: (max%MI)*4)-((min%MI)*4)); + if (min / MI == t) + { + if (min % MI + (max - min) >= MI) + memset (xf->buf+((min%MI)*4), 0xff, (MI-(min%MI))*4); + else + memset (xf->buf+((min%MI)*4), 0xff, (max-min+1)*4); + } + else + { + /* + * assert(response % MI == 0); + * we do assume that here and if it is not + * so an error must have occurred. + */ + if (max - t * MI >= MI) + memset(xf->buf, 0xff, MI*4); + else + memset(xf->buf, 0xff, (max-t*MI+1)*4); + } } else { if (!xf->locked) /* size can't change if we have locked it */ @@ -683,6 +702,8 @@ */ if (min) { + if (!syncGroup()) return FALSE; + xover_output (min, max); return TRUE; } @@ -921,6 +942,12 @@ { char line[MAX_LINE]; + if (!syncGroup()) + { + emitrn (NNTP_NOTINGROUP); + return; + } + Cemit (args); Cflush (); if (!Cget (line, sizeof line)) @@ -996,6 +1023,12 @@ struct server_cfg *osrvrs = ServerList; struct server_cfg *cf; + if (!syncGroup()) + { + emitrn (NNTP_NOTINGROUP); + return; + } + Cemit (args); Cflush (); if (!Cget (buf, sizeof buf)) @@ -1077,6 +1110,12 @@ } if (CurrentScfg->xover_timeout < 1 || !isFieldInXover(header) || !CurrentScfg->overview_fmt) { + if (!syncGroup()) + { + emitrn (NNTP_NOTINGROUP); + return; + } + Cemit (args); Cflush (); if (!Cget (buf, sizeof buf))