INN commit: trunk (5 files)
INN Commit
rra at isc.org
Sun Jan 17 11:51:04 UTC 2010
Date: Sunday, January 17, 2010 @ 03:51:04
Author: iulius
Revision: 8890
Add complete support for uwildmats in ovgrouppat: negated
patterns "!" are now taken into account (and not considered
as poisoned patterns "@").
Also fix a wrong memchr length.
Modified:
trunk/doc/pod/inn.conf.pod
trunk/lib/uwildmat.c
trunk/storage/expire.c
trunk/storage/ov.c
trunk/storage/ovinterface.h
-----------------------+
doc/pod/inn.conf.pod | 6 +-----
lib/uwildmat.c | 6 +++---
storage/expire.c | 21 +++++++++++++++------
storage/ov.c | 21 +++++++++++++++------
storage/ovinterface.h | 2 +-
5 files changed, 35 insertions(+), 21 deletions(-)
Modified: doc/pod/inn.conf.pod
===================================================================
--- doc/pod/inn.conf.pod 2010-01-16 23:29:42 UTC (rev 8889)
+++ doc/pod/inn.conf.pod 2010-01-17 11:51:04 UTC (rev 8890)
@@ -558,16 +558,12 @@
=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.
The default is unset.
-Note that the use of C<!> in this wildmat expression has the same meaning as
-C<@>, that is to say it is a poisoned match and the overview data will not
-be generated if one of the newsgroups an article is posted to is unwanted.
-
=item I<ovmethod>
Which overview storage method to use. Currently supported values are
Modified: lib/uwildmat.c
===================================================================
--- lib/uwildmat.c 2010-01-16 23:29:42 UTC (rev 8889)
+++ lib/uwildmat.c 2010-01-17 11:51:04 UTC (rev 8890)
@@ -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-16 23:29:42 UTC (rev 8889)
+++ storage/expire.c 2010-01-17 11:51:04 UTC (rev 8890)
@@ -813,28 +813,37 @@
return HISlookup(h, p, NULL, NULL, NULL, NULL);
}
-bool
+/*
+** Return the matching status of the group (UWILDMAT_MATCH,
+** UWILDMAT_FAIL, or UWILDMAT_POISON).
+*/
+enum uwildmat
OVgroupmatch(const char *group)
{
int i;
- bool wanted = false;
+ enum uwildmat result = UWILDMAT_FAIL;
if (OVnumpatterns == 0 || group == NULL)
return true;
for (i = 0; i < OVnumpatterns; i++) {
switch (OVpatterns[i][0]) {
case '!':
+ if (uwildmat(group, &OVpatterns[i][1])) {
+ result = UWILDMAT_FAIL;
+ }
+ break;
case '@':
if (uwildmat(group, &OVpatterns[i][1])) {
- wanted = false;
+ result = UWILDMAT_POISON;
}
break;
default:
- if (uwildmat(group, OVpatterns[i]))
- wanted = true;
+ if (uwildmat(group, OVpatterns[i])) {
+ result = UWILDMAT_MATCH;
+ }
}
}
- return wanted;
+ return result;
}
void
Modified: storage/ov.c
===================================================================
--- storage/ov.c 2010-01-16 23:29:42 UTC (rev 8889)
+++ storage/ov.c 2010-01-17 11:51:04 UTC (rev 8890)
@@ -129,6 +129,7 @@
int i;
char *group;
ARTNUM artnum;
+ enum uwildmat groupmatch;
if (!ov.open) {
/* Must be opened. */
@@ -197,16 +198,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 = OVgroupmatch(group);
+ 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 +228,10 @@
if (artnum <= 0)
continue;
+ /* Skip overview generation according to ovgrouppat. */
+ if (innconf->ovgrouppat != NULL && OVgroupmatch(group) != 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-16 23:29:42 UTC (rev 8889)
+++ storage/ovinterface.h 2010-01-17 11:51:04 UTC (rev 8890)
@@ -37,7 +37,7 @@
bool OVgroupbasedexpire(TOKEN token, const char *group, const char *data,
int len, time_t arrived, time_t expires);
-bool OVgroupmatch(const char *group);
+enum uwildmat OVgroupmatch(const char *group);
bool OVhisthasmsgid(struct history *, const char *data);
void OVEXPremove(TOKEN token, bool deletedgroups, char **xref, int ngroups);
void OVEXPcleanup(void);
More information about the inn-committers
mailing list