INN commit: branches/2.5 (6 files)
INN Commit
rra at isc.org
Fri Jan 22 23:28:28 UTC 2010
Date: Friday, January 22, 2010 @ 15:28:28
Author: iulius
Revision: 8918
Fixed a bug in the parsing of the ovgrouppat: wildmat in inn.conf
that prevented overview data from being generated when poisoned groups
were specified but a latter sub-pattern made the group wanted.
Add complete support for uwildmats in ovgrouppat: negated
patterns "!" are now taken into account (and not considered
as poisoned patterns "@").
Optimize how ovgrouppat is handled.
Thanks to D. Stussy for the bug report.
Also fix a wrong memchr length.
Modified:
branches/2.5/doc/pod/inn.conf.pod
branches/2.5/doc/pod/news.pod
branches/2.5/lib/uwildmat.c
branches/2.5/storage/expire.c
branches/2.5/storage/ov.c
branches/2.5/storage/ovinterface.h
-----------------------+
doc/pod/inn.conf.pod | 2 +-
doc/pod/news.pod | 7 +++++++
lib/uwildmat.c | 6 +++---
storage/expire.c | 37 ++-----------------------------------
storage/ov.c | 35 +++++++++++++++++------------------
storage/ovinterface.h | 3 ---
6 files changed, 30 insertions(+), 60 deletions(-)
Modified: doc/pod/inn.conf.pod
===================================================================
--- doc/pod/inn.conf.pod 2010-01-22 23:20:31 UTC (rev 8917)
+++ doc/pod/inn.conf.pod 2010-01-22 23:28:28 UTC (rev 8918)
@@ -545,7 +545,7 @@
=item I<ovgrouppat>
If set, restricts the overview data stored by INN to only the newsgroups
-matching this comma-separated list of wildmat expressions. Newsgroups not
+matching this comma-separated list of uwildmat(3) expressions. Newsgroups not
matching this setting may not be readable, and if I<groupbaseexpiry> is
set to true and the storage method for these newsgroups does not have
self-expire functionality, storing overview data will fail.
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2010-01-22 23:20:31 UTC (rev 8917)
+++ doc/pod/news.pod 2010-01-22 23:28:28 UTC (rev 8918)
@@ -196,6 +196,13 @@
=item *
+Fixed a bug in the parsing of the I<ovgrouppat> wildmat in F<inn.conf>
+that prevented overview data from being generated when poisoned groups
+were specified but a latter sub-pattern made the group wanted. Thanks
+to S<D. Stussy> for the bug report.
+
+=item *
+
Fixed a bug when HDR, XHDR and XPAT were used when I<virtualhost> was set
to true in F<readers.conf>. The Xref: header of articles posted to only
one newsgroup appeared empty.
Modified: lib/uwildmat.c
===================================================================
--- lib/uwildmat.c 2010-01-22 23:20:31 UTC (rev 8917)
+++ lib/uwildmat.c 2010-01-22 23:28:28 UTC (rev 8918)
@@ -328,10 +328,10 @@
/*
** Takes text and a wildmat expression; a wildmat expression is a
** comma-separated list of wildmat patterns, optionally preceded by ! to
-** invert the sense of the expression. Returns WILDMAT_MATCH if that
-** expression matches the text, WILDMAT_FAIL otherwise. If allowpoison is
+** invert the sense of the expression. Returns UWILDMAT_MATCH if that
+** expression matches the text, UWILDMAT_FAIL otherwise. If allowpoison is
** set, allow @ to introduce a poison expression (the same as !, but if it
-** triggers the failed match the routine returns WILDMAT_POISON instead).
+** triggers the failed match the routine returns UWILDMAT_POISON instead).
*/
static enum uwildmat
match_expression(const unsigned char *text, const unsigned char *start,
Modified: storage/expire.c
===================================================================
--- storage/expire.c 2010-01-22 23:20:31 UTC (rev 8917)
+++ storage/expire.c 2010-01-22 23:28:28 UTC (rev 8918)
@@ -4,8 +4,8 @@
**
** In order to expire on a per-newsgroup (instead of per-storage-class)
** basis, one has to use overview-driven expiration. This contains all of
-** the code to do that. It provides OVgroupbasedexpire, OVhisthasmsgid, and
-** OVgroupmatch for the use of various overview methods.
+** the code to do that. It provides OVgroupbasedexpire and OVhisthasmsgid
+** for the use of various overview methods.
*/
#include "config.h"
@@ -101,8 +101,6 @@
bool OVkeep;
bool OVearliest;
bool OVquiet;
-int OVnumpatterns;
-char ** OVpatterns;
/*
@@ -813,32 +811,6 @@
return HISlookup(h, p, NULL, NULL, NULL, NULL);
}
-bool
-OVgroupmatch(const char *group)
-{
- int i;
- bool wanted = false;
-
- if (OVnumpatterns == 0 || group == NULL)
- return true;
- for (i = 0; i < OVnumpatterns; i++) {
- switch (OVpatterns[i][0]) {
- case '!':
- if (!wanted && uwildmat(group, &OVpatterns[i][1]))
- break;
- case '@':
- if (uwildmat(group, &OVpatterns[i][1])) {
- return false;
- }
- break;
- default:
- if (uwildmat(group, OVpatterns[i]))
- wanted = true;
- }
- }
- return wanted;
-}
-
void
OVEXPcleanup(void)
{
@@ -855,11 +827,6 @@
}
EXPprocessed = EXPunlinked = EXPoverindexdrop = 0;
}
- if (innconf->ovgrouppat != NULL) {
- for (i = 0 ; i < OVnumpatterns ; i++)
- free(OVpatterns[i]);
- free(OVpatterns);
- }
for (bg = EXPbadgroups; bg; bg = bgnext) {
bgnext = bg->Next;
free(bg->Name);
Modified: storage/ov.c
===================================================================
--- storage/ov.c 2010-01-22 23:20:31 UTC (rev 8917)
+++ storage/ov.c 2010-01-22 23:28:28 UTC (rev 8918)
@@ -36,7 +36,6 @@
{
int i;
bool val;
- char *p;
if (ov.open)
/* already opened */
@@ -68,17 +67,6 @@
OVclose();
return false;
}
- if (innconf->ovgrouppat != NULL) {
- for (i = 1, p = innconf->ovgrouppat; *p && (p = strchr(p+1, ',')); i++);
- OVnumpatterns = i;
- OVpatterns = xmalloc(OVnumpatterns * sizeof(char *));
- for (i = 0, p = strtok(innconf->ovgrouppat, ","); p != NULL && i <= OVnumpatterns ; i++, p = strtok(NULL, ","))
- OVpatterns[i] = xstrdup(p);
- if (i != OVnumpatterns) {
- warn("extra ',' in pattern");
- return false;
- }
- }
return val;
}
@@ -129,6 +117,7 @@
int i;
char *group;
ARTNUM artnum;
+ enum uwildmat groupmatch;
if (!ov.open) {
/* Must be opened. */
@@ -197,16 +186,20 @@
for (group = patcheck; group && *group; group = memchr(nextcheck, ' ', xreflen - (nextcheck - patcheck))) {
while (isspace((int)*group))
group++;
- if ((nextcheck = memchr(group, ':', xreflen - (patcheck - group))) == NULL)
+ if ((nextcheck = memchr(group, ':', xreflen - (group - patcheck))) == NULL)
return OVADDFAILED;
*nextcheck++ = '\0';
- if (!OVgroupmatch(group)) {
- if (!SMprobe(SELFEXPIRE, &token, NULL) && innconf->groupbaseexpiry)
+
+ groupmatch = uwildmat_poison(group, innconf->ovgrouppat);
+ if (groupmatch == UWILDMAT_POISON) {
+ return OVADDGROUPNOMATCH;
+ } else if (groupmatch == UWILDMAT_FAIL) {
+ if (!SMprobe(SELFEXPIRE, &token, NULL) && innconf->groupbaseexpiry) {
/* This article will never be expired, since it does not
- have self expiry function in stored method and
- groupbaseexpiry is true. */
+ * have self expiry function in stored method and
+ * groupbaseexpiry is true. */
return OVADDFAILED;
- return OVADDGROUPNOMATCH;
+ }
}
}
}
@@ -223,6 +216,12 @@
if (artnum <= 0)
continue;
+ /* Skip overview generation according to ovgrouppat. */
+ if (innconf->ovgrouppat != NULL
+ && uwildmat_poison(group, innconf->ovgrouppat) != UWILDMAT_MATCH) {
+ continue;
+ }
+
sprintf(overdata, "%ld\t", artnum);
i = strlen(overdata);
memcpy(overdata + i, data, len);
Modified: storage/ovinterface.h
===================================================================
--- storage/ovinterface.h 2010-01-22 23:20:31 UTC (rev 8917)
+++ storage/ovinterface.h 2010-01-22 23:28:28 UTC (rev 8918)
@@ -37,7 +37,6 @@
bool OVgroupbasedexpire(TOKEN token, const char *group, const char *data,
int len, time_t arrived, time_t expires);
-bool OVgroupmatch(const char *group);
bool OVhisthasmsgid(struct history *, const char *data);
void OVEXPremove(TOKEN token, bool deletedgroups, char **xref, int ngroups);
void OVEXPcleanup(void);
@@ -52,8 +51,6 @@
extern bool OVkeep;
extern bool OVearliest;
extern bool OVquiet;
-extern int OVnumpatterns;
-extern char **OVpatterns;
extern time_t OVrealnow;
extern long EXPprocessed;
extern long EXPunlinked;
More information about the inn-committers
mailing list