Thread View: news.software.nntp
70 messages
70 total messages
Page 2 of 2
Started by Julien ÉLIE
Sun, 10 Jan 2010 09:37
Page 2 of 2 • 70 total messages
Re: unrelated possible bug with C flag?
Author: Julien ÉLIE
Date: Wed, 27 Jan 2010 20:48
Date: Wed, 27 Jan 2010 20:48
97 lines
4561 bytes
4561 bytes
Answering to myself:
> --- art.c (révision 8911)
> +++ art.c (copie de travail)
> @@ -2159,13 +2159,24 @@
> }
>
> if (HDR_FOUND(HDR__FOLLOWUPTO)) {
> - for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; (p = strchr(p, ',')) != NULL ;
> - i++, p++)
> - continue;
> + for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; p != NULL && *p != '\0'; p++) {
> + /* Skip leading whitespaces. */
> + for (; *p && ISWHITE(*p) ; p++)
> + continue;
I've improved the patch to also skip folding whitespaces and take into
account Russ' remark about "poster" when used in a newsgroup list.
The whole process would be:
if (HDR_FOUND(HDR__FOLLOWUPTO)) {
PosterGroup = false;
for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; p != NULL && *p != '\0'; p++) {
/* Skip leading whitespaces. */
p = (char *) skip_fws(p);
if (*p != '\0' && *p != ',')
i++;
/* Check whether "poster" is in the header field. */
if (strncasecmp(p, "poster", 6) == 0
&& (p[6] == ',' || p[6] == ' ' || p[6] == '\t'
|| p[6] == '\r' || p[6] == '\n' || p[6] == '\0')) {
PosterGroup = true;
}
if ((p = strchr(p, ',')) == NULL)
break;
}
/* When "poster" is the only value, then it is not a followup.
* Otherwise, it is a followup to a newsgroup named "poster". */
if (PosterGroup && i == 1) {
data->Followcount = 0;
} else {
data->Followcount = i;
}
} else {
data->Followcount = data->Groupcount;
}
With this new skip_fws function (designed like the existing skip_cfws):
--- lib/headers.c (révision 8880)
+++ lib/headers.c (copie de travail)
@@ -86,3 +86,32 @@
}
return p;
}
+
+
+/*
+** Skip any amount of FWS (folding whitespace), the RFC 5322 grammar term
+** for whitespace and CRLF pairs. We also allow simple newlines since we don't
+** always deal with wire-format messages. Note that we do not attempt to
+** ensure that CRLF or a newline is followed by whitespace. Returns the new
+** position of the pointer.
+*/
+const char *
+skip_fws(const char *p)
+{
+ for (; *p != '\0'; p++) {
+ switch (*p) {
+ case ' ':
+ case '\t':
+ case '\n':
+ break;
+ case '\r':
+ if (p[1] != '\n')
+ return p;
+ break;
+ default:
+ return p;
+ }
+ }
+ return p;
+}
--
Julien ÉLIE
« -- Ouvre l'œil, et le bon !
-- L'autre, je peux pas encore l'ouvrir, je risque pas de me tromper ! » (Astérix)
Re: New draft for LIST additions (-02)
Author: Julien ÉLIE
Date: Wed, 27 Jan 2010 21:00
Date: Wed, 27 Jan 2010 21:00
32 lines
3113 bytes
3113 bytes
Hi Russ,
> Oh, I misunderstood the problem.
That proves that my wording was not right. I should not have used "post"
because it is a confusing notion.
Let's use "locally posted" or "arriving from peer" to be consistent.
> Yes, for postings received from peers,
> we obviously can't forward them to a moderator, so the choice is to reject
> them or accept them and file them despite not being approved. So yes, I
> think your current approach is probably the best of the two, but it's
> probably worth a caution that in general one SHOULD NOT alias a group to a
> moderated group since it allows bypassing of the moderation.
New suggested wording:
The status of the newsgroup an alias points to MUST NOT be
taken into account when an article arrives in an alias newsgroup.
In particular, it means that unapproved articles arriving from peers
in an alias pointing to a moderated newsgroup are accepted and
filed into this moderated newsgroup. Therefore, an alias SHOULD
NOT point to a moderated newsgroup since it allows bypassing of
the moderation.
--
Julien ÉLIE
« -- Ouvre l'œil, et le bon !
-- L'autre, je peux pas encore l'ouvrir, je risque pas de me tromper ! » (Astérix)
Re: unrelated possible bug with C flag?
Author: D. Stussy
Date: Thu, 28 Jan 2010 01:08
Date: Thu, 28 Jan 2010 01:08
11 lines
2088 bytes
2088 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:hjnr85$gji$1@news.trigofacile.com... > ... > N.B.: This article has "Followup-To: news.software.nntp,poster" in case > someone wants to test the behaviour of his reader. > Windows Mail at least answers in news.software.nntp + Cc the author. Outlook Express V6 generated a reply to the group only and discarded "poster."
Re: unrelated possible bug with C flag?
Author: D. Stussy
Date: Thu, 28 Jan 2010 01:28
Date: Thu, 28 Jan 2010 01:28
122 lines
5453 bytes
5453 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:hjq8r4$s5h$1@news.trigofacile.com...
> Answering to myself:
>
> > --- art.c (révision 8911)
> > +++ art.c (copie de travail)
> > @@ -2159,13 +2159,24 @@
> > }
> >
> > if (HDR_FOUND(HDR__FOLLOWUPTO)) {
> > - for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; (p = strchr(p, ',')) !=
NULL ;
> > - i++, p++)
> > - continue;
> > + for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; p != NULL && *p != '\0';
p++) {
> > + /* Skip leading whitespaces. */
> > + for (; *p && ISWHITE(*p) ; p++)
> > + continue;
I agree with changing the [outer] for-loop conditional to just "p != NULL",
but it's the internals of the loop I think are a problem.
I've been busy with work the past 3 days, but thought about this. I would
have replaced the "continue" with "p = strchr( ++p, ',')" and remove the
p++ from the loop-closure. As we're only counting, I don't think we have
to worry about whitespace.
> I've improved the patch to also skip folding whitespaces and take into
> account Russ' remark about "poster" when used in a newsgroup list.
>
> The whole process would be:
>
> if (HDR_FOUND(HDR__FOLLOWUPTO)) {
> PosterGroup = false;
> for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; p != NULL && *p != '\0'; p++)
{
> /* Skip leading whitespaces. */
> p = (char *) skip_fws(p);
>
> if (*p != '\0' && *p != ',')
> i++;
>
> /* Check whether "poster" is in the header field. */
> if (strncasecmp(p, "poster", 6) == 0
> && (p[6] == ',' || p[6] == ' ' || p[6] == '\t'
> || p[6] == '\r' || p[6] == '\n' || p[6] == '\0')) {
> PosterGroup = true;
> }
>
> if ((p = strchr(p, ',')) == NULL)
> break;
> }
>
> /* When "poster" is the only value, then it is not a followup.
> * Otherwise, it is a followup to a newsgroup named "poster". */
> if (PosterGroup && i == 1) {
> data->Followcount = 0;
> } else {
> data->Followcount = i;
> }
> } else {
> data->Followcount = data->Groupcount;
> }
>
>
>
> With this new skip_fws function (designed like the existing skip_cfws):
>
> --- lib/headers.c (révision 8880)
> +++ lib/headers.c (copie de travail)
> @@ -86,3 +86,32 @@
> }
> return p;
> }
> +
> +
> +/*
> +** Skip any amount of FWS (folding whitespace), the RFC 5322 grammar
term
> +** for whitespace and CRLF pairs. We also allow simple newlines since
we don't
> +** always deal with wire-format messages. Note that we do not attempt
to
> +** ensure that CRLF or a newline is followed by whitespace. Returns
the new
> +** position of the pointer.
> +*/
> +const char *
> +skip_fws(const char *p)
> +{
> + for (; *p != '\0'; p++) {
> + switch (*p) {
> + case ' ':
> + case '\t':
> + case '\n':
> + break;
> + case '\r':
> + if (p[1] != '\n')
> + return p;
> + break;
> + default:
> + return p;
> + }
> + }
> + return p;
> +}
I think that RFC 1036 made it clear: "poster", with its special meaning,
may only appear alone. Therefore, we don't have to check to see if it's
specified in the string; only that it IS the string of the "newsgroups:"
header data field. I don't see any change in RFC 5536 to this behavior.
Since different clients had different responses to encountering "poster"
with a group, post + email, post to group "poster", or ignoring "poster",
current client behavior is not controlling. I believe that the RFCs imply
that such an article should not have been accepted in the first place, and
therefore, the varying client responses are [responses] to a condition that
never should have arisen.
Re: New draft for LIST additions (-02)
Author: Jeffrey M. Vinocur
Date: Thu, 28 Jan 2010 10:54
Date: Thu, 28 Jan 2010 10:54
18 lines
1692 bytes
1692 bytes
In article <87iqanfg2i.fsf@windlord.stanford.edu>, Russ Allbery <rra@stanford.edu> wrote: > >Oh, I misunderstood the problem. Yes, for postings received from peers, >we obviously can't forward them to a moderator, so the choice is to reject >them or accept them and file them despite not being approved. Why can't we treat them like articles arriving from a peer for any other moderated group? Obviously this would making existing INN implementations noncompliant, but it's a subtle difference that an explanatory note might suffice for? -- Jeffrey M. Vinocur jeff@litech.org
Re: New draft for LIST additions (-02)
Author: Julien ÉLIE
Date: Thu, 28 Jan 2010 17:30
Date: Thu, 28 Jan 2010 17:30
18 lines
2118 bytes
2118 bytes
Hi Jeffrey, >>Oh, I misunderstood the problem. Yes, for postings received from peers, >>we obviously can't forward them to a moderator, so the choice is to reject >>them or accept them and file them despite not being approved. > > Why can't we treat them like articles arriving from a peer for > any other moderated group? If we do that, it would also mean to be consistent with all other flags (rejecting if the status is "x", resolving recursive alias...), wouldn't it? -- Julien ÉLIE « -- Ouvre l'œil, et le bon ! -- L'autre, je peux pas encore l'ouvrir, je risque pas de me tromper ! » (Astérix)
Re: unrelated possible bug with C flag?
Author: Julien ÉLIE
Date: Thu, 28 Jan 2010 17:49
Date: Thu, 28 Jan 2010 17:49
54 lines
3745 bytes
3745 bytes
Hi D. Stussy,
>> + for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; p != NULL && *p != '\0'; p++) {
>
> I agree with changing the [outer] for-loop conditional to just "p != NULL"
Even with nothing at all because if *p is '\0', the loop will end after
the search of ",".
> I've been busy with work the past 3 days, but thought about this. I would
> have replaced the "continue" with "p = strchr( ++p, ',')" and remove the
> p++ from the loop-closure. As we're only counting, I don't think we have
> to worry about whitespace.
The problem is that we do not properly see:
Followup-To: poster,
Followup-To: news.group1,,news.group2
The first one would not be parsed as a real "poster" and the second one
would count 3 groups.
The only thing that is not handled here is newsgroups mentioned twice...
Followup-To: poster , poster
Followup-To: news.group1, news.group1 , news.group2
> I think that RFC 1036 made it clear: "poster", with its special meaning,
> may only appear alone. Therefore, we don't have to check to see if it's
> specified in the string; only that it IS the string of the "newsgroups:"
> header data field. I don't see any change in RFC 5536 to this behavior.
I am following here the law "be liberal in what you accept" because innd
is not an injecting agent. We will not reject the article because of an
error in the syntax of the Followup-To: header.
> the varying client responses are [responses] to a condition that
> never should have arisen.
They are liberal in what they accept too. And try to do their best.
--
Julien ÉLIE
« -- Ouvre l'œil, et le bon !
-- L'autre, je peux pas encore l'ouvrir, je risque pas de me tromper ! » (Astérix)
Re: New draft for LIST additions (-02)
Author: Russ Allbery
Date: Thu, 28 Jan 2010 18:03
Date: Thu, 28 Jan 2010 18:03
24 lines
2234 bytes
2234 bytes
jeff@litech.org (Jeffrey M. Vinocur) writes:
> Russ Allbery <rra@stanford.edu> wrote:
>> Oh, I misunderstood the problem. Yes, for postings received from
>> peers, we obviously can't forward them to a moderator, so the choice is
>> to reject them or accept them and file them despite not being approved.
> Why can't we treat them like articles arriving from a peer for
> any other moderated group?
Well, it depends on what we think the goal of the local administrator is.
If someone aliases an unmoderated group to a moderated group, the effect
of that would be to just throw away all of the traffic, about the same as
if they'd just deleted the group entirely. If they alias a moderated
group to another moderated group, it would of course work.
I'm really not sure what the most common case is here and what makes the
most sense to do.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: unrelated possible bug with C flag?
Author: D. Stussy
Date: Thu, 28 Jan 2010 21:27
Date: Thu, 28 Jan 2010 21:27
75 lines
4388 bytes
4388 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:hjsinn$cst$1@news.trigofacile.com...
> Hi D. Stussy,
>
> >> + for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; p != NULL && *p != '\0'; p++)
{
> >
> > I agree with changing the [outer] for-loop conditional to just "p !=
NULL"
>
> Even with nothing at all because if *p is '\0', the loop will end after
> the search of ",".
>
> > I've been busy with work the past 3 days, but thought about this. I
would
> > have replaced the "continue" with "p = strchr( ++p, ',')" and remove
the
> > p++ from the loop-closure. As we're only counting, I don't think we
have
> > to worry about whitespace.
for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; p != NULL ; i++)
p = strchr( ++p, ',');
is ALL that is necessary to arrive at a preliminary proper count of "i" =
groups specified, given a SYNTACTICALLY correct "Followup-To:" header.
Adjustment for (i=1 and "poster") or (i=0) follows.
> The problem is that we do not properly see:
>
> Followup-To: poster,
> Followup-To: news.group1,,news.group2
>
> The first one would not be parsed as a real "poster" and the second one
> would count 3 groups.
Neither of these should be accepted in the first place. A "null group"
isn't valid.
> The only thing that is not handled here is newsgroups mentioned twice...
>
> Followup-To: poster , poster
> Followup-To: news.group1, news.group1 , news.group2
I agree that the above may be problems. The whitespace ISN'T a problem
when we're merely COUNTING groups.
> > I think that RFC 1036 made it clear: "poster", with its special
meaning,
> > may only appear alone. Therefore, we don't have to check to see if
it's
> > specified in the string; only that it IS the string of the
"newsgroups:"
> > header data field. I don't see any change in RFC 5536 to this
behavior.
>
> I am following here the law "be liberal in what you accept" because innd
> is not an injecting agent. We will not reject the article because of an
> error in the syntax of the Followup-To: header.
No argument with the principle. However, if we're at this point, we're
dealing with articles that have already been accepted into the spool. This
is not the place to deal with invalid syntax. That should be done in NNRPD
(for locally submitted articles) and elsewhere in INN for articles from
peers.
> > the varying client responses are [responses] to a condition that
> > never should have arisen.
>
> They are liberal in what they accept too. And try to do their best.
Your suggested patch is trying to perform syntax checking too late in the
process. These are articles already accepted and stored in the spool.
Re: New draft for LIST additions (-02)
Author: D. Stussy
Date: Thu, 28 Jan 2010 21:32
Date: Thu, 28 Jan 2010 21:32
30 lines
2608 bytes
2608 bytes
"Russ Allbery" <rra@stanford.edu> wrote in message news:874om6nm3j.fsf@windlord.stanford.edu... > jeff@litech.org (Jeffrey M. Vinocur) writes: > > Russ Allbery <rra@stanford.edu> wrote: > > >> Oh, I misunderstood the problem. Yes, for postings received from > >> peers, we obviously can't forward them to a moderator, so the choice is > >> to reject them or accept them and file them despite not being approved. > > > Why can't we treat them like articles arriving from a peer for > > any other moderated group? > > Well, it depends on what we think the goal of the local administrator is. > If someone aliases an unmoderated group to a moderated group, the effect > of that would be to just throw away all of the traffic, about the same as > if they'd just deleted the group entirely. If they alias a moderated > group to another moderated group, it would of course work. > > I'm really not sure what the most common case is here and what makes the > most sense to do. We could choose to disallow the aliasing of an unmoderated group to a moderated group in a future RFC (a "should not") and simply not bother to enforce it. The unapproved articles in the moderated group would be so only on the system(s) so aliasing it, so that's a local configuration problem at best.
Re: unrelated possible bug with C flag?
Author: Julien ÉLIE
Date: Thu, 28 Jan 2010 21:58
Date: Thu, 28 Jan 2010 21:58
37 lines
3520 bytes
3520 bytes
Hi D. Stussy, >> I am following here the law "be liberal in what you accept" because innd >> is not an injecting agent. We will not reject the article because of an >> error in the syntax of the Followup-To: header. > > No argument with the principle. However, if we're at this point, we're > dealing with articles that have already been accepted into the spool. This > is not the place to deal with invalid syntax. That should be done in NNRPD > (for locally submitted articles) and elsewhere in INN for articles from > peers. I do not understand where else you would want to do that. Here, we are counting how many groups are in the Followup-To: header. It is our role of *relaying* agent because this count has an impact on the C option in newsfeeds. Well, I do not mind badly checking this number. I thought it would be better for our own outgoing peers... Otherwise, we can prevent articles from being sent to our peers because of ",,,," whereas they should have received them. > Your suggested patch is trying to perform syntax checking too late in the > process. These are articles already accepted and stored in the spool. Why is it "too late in the process"? Why is it "syntax checking"? I'm just parsing the header field value, following a laxer and more liberal syntax, so as to count the number of newsgroups and see whether "poster" is the only one specified. -- Julien ÉLIE « Vous savez, les idées, elles sont dans l'air. Il suffit que quelqu'un vous en parle de trop près, pour que vous les attrapiez ! » (Raymond Devos)
Re: unrelated possible bug with C flag?
Author: D. Stussy
Date: Thu, 28 Jan 2010 22:30
Date: Thu, 28 Jan 2010 22:30
49 lines
4033 bytes
4033 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:hjt1a2$u54$1@news.trigofacile.com... > >> I am following here the law "be liberal in what you accept" because innd > >> is not an injecting agent. We will not reject the article because of an > >> error in the syntax of the Followup-To: header. > > > > No argument with the principle. However, if we're at this point, we're > > dealing with articles that have already been accepted into the spool. This > > is not the place to deal with invalid syntax. That should be done in NNRPD > > (for locally submitted articles) and elsewhere in INN for articles from > > peers. > > I do not understand where else you would want to do that. > Here, we are counting how many groups are in the Followup-To: header. > It is our role of *relaying* agent because this count has an impact > on the C option in newsfeeds. Correct - and that's ALL we should be doing at this step. Whitespace doesn't matter. Basically, if the field is specfied (i.e. not empty), the count is the number of commas plus 1. If exactly one (i.e. no commas), then a check to the literal "poster" is performed. Anything more (like checking to see if a group name is specified more than once, is null, etc.) is syntax checking that should be done BEFORE accepting the article. Determining where to feed it is an action taken AFTER acceptance. > Well, I do not mind badly checking this number. I thought it would be > better for our own outgoing peers... Otherwise, we can prevent articles > from being sent to our peers because of ",,,," whereas they should have > received them. Why did we accept such an article to begin with? > > Your suggested patch is trying to perform syntax checking too late in the > > process. These are articles already accepted and stored in the spool. > > Why is it "too late in the process"? Why is it "syntax checking"? > I'm just parsing the header field value, following a laxer and more > liberal syntax, so as to count the number of newsgroups and see whether > "poster" is the only one specified. It's too late because we've already accepted the article - as opposed to rejecting it for bad syntax.
Re: unrelated possible bug with C flag?
Author: Julien ÉLIE
Date: Thu, 28 Jan 2010 22:47
Date: Thu, 28 Jan 2010 22:47
32 lines
3147 bytes
3147 bytes
Hi D. Stussy,
>> Here, we are counting how many groups are in the Followup-To: header.
>> It is our role of *relaying* agent because this count has an impact
>> on the C option in newsfeeds.
>
> Correct - and that's ALL we should be doing at this step. Whitespace
> doesn't matter. Basically, if the field is specfied (i.e. not empty), the
> count is the number of commas plus 1. If exactly one (i.e. no commas),
> then a check to the literal "poster" is performed.
OK, then a check to "poster" -- where whitespace matters -- is to be done
only where there are 0 commas ("is 0 comma"?).
I'm fine with that.
>> Well, I do not mind badly checking this number. I thought it would be
>> better for our own outgoing peers... Otherwise, we can prevent articles
>> from being sent to our peers because of ",,,," whereas they should have
>> received them.
>
> Why did we accept such an article to begin with?
Because not all injecting agents enforce such rules.
Not all injecting agents are (and probably will be) compliant with RFC 5537.
--
Julien ÉLIE
« Vous savez, les idées, elles sont dans l'air. Il suffit que quelqu'un
vous en parle de trop près, pour que vous les attrapiez ! » (Raymond Devos)
Re: unrelated possible bug with C flag?
Author: D. Stussy
Date: Sat, 30 Jan 2010 00:55
Date: Sat, 30 Jan 2010 00:55
37 lines
3130 bytes
3130 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:hjt45t$167$1@news.trigofacile.com...
> >> Here, we are counting how many groups are in the Followup-To: header.
> >> It is our role of *relaying* agent because this count has an impact
> >> on the C option in newsfeeds.
> >
> > Correct - and that's ALL we should be doing at this step. Whitespace
> > doesn't matter. Basically, if the field is specfied (i.e. not empty),
the
> > count is the number of commas plus 1. If exactly one (i.e. no commas),
> > then a check to the literal "poster" is performed.
>
> OK, then a check to "poster" -- where whitespace matters -- is to be done
> only where there are 0 commas ("is 0 comma"?).
> I'm fine with that.
I thought that's what I did in my proposal earlier....
i = number of groups, NOT number of commas. Therefore poster => i=1.
> >> Well, I do not mind badly checking this number. I thought it would be
> >> better for our own outgoing peers... Otherwise, we can prevent
articles
> >> from being sent to our peers because of ",,,," whereas they should
have
> >> received them.
> >
> > Why did we accept such an article to begin with?
>
> Because not all injecting agents enforce such rules.
> Not all injecting agents are (and probably will be) compliant with RFC
5537.
Did RFC 1036 say differently? If not, then these have been errors for 22
years.
Re: unrelated possible bug with C flag?
Author: Julien ÉLIE
Date: Sat, 30 Jan 2010 20:12
Date: Sat, 30 Jan 2010 20:12
114 lines
5718 bytes
5718 bytes
Hi Dieter,
> I thought that's what I did in my proposal earlier....
>
> i = number of groups, NOT number of commas. Therefore poster => i=1.
Then the (complete) patch is the following:
Index: include/inn/libinn.h
===================================================================
--- include/inn/libinn.h (révision 8880)
+++ include/inn/libinn.h (copie de travail)
@@ -157,6 +157,7 @@
extern bool IsValidMessageID(const char *string, bool stripspaces);
extern bool IsValidHeaderName(const char *string);
extern const char * skip_cfws(const char *p);
+extern const char * skip_fws(const char *p);
extern void HeaderCleanFrom(char *from);
extern struct _DDHANDLE * DDstart(FILE *FromServer, FILE *ToServer);
extern void DDcheck(struct _DDHANDLE *h, char *group);
Index: innd/art.c
===================================================================
--- innd/art.c (révision 8911)
+++ innd/art.c (copie de travail)
@@ -2159,13 +2159,25 @@
}
if (HDR_FOUND(HDR__FOLLOWUPTO)) {
- for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; (p = strchr(p, ',')) != NULL ;
- i++, p++)
- continue;
+ for (i = 1, p = HDR(HDR__FOLLOWUPTO) ; (p = strchr(p, ',')) != NULL ;
+ i++, p++) ;
+
data->Followcount = i;
+
+ /* When "poster" is the only value, then it is not a followup. */
+ if (i == 1) {
+ /* Skip leading whitespaces. */
+ p = (char *) skip_fws(HDR(HDR__FOLLOWUPTO));
+
+ if (strncasecmp(p, "poster", 6) == 0
+ && (p[6] == ' ' || p[6] == '\t' || p[6] == '\0'
+ || p[6] == '\r' || p[6] == '\n')) {
+ data->Followcount = 0;
+ }
+ }
+ } else {
+ data->Followcount = data->Groupcount;
}
- if (data->Followcount == 0)
- data->Followcount = data->Groupcount;
groups = data->Newsgroups.List;
/* Parse the Control header. */
Index: lib/headers.c
===================================================================
--- lib/headers.c (révision 8880)
+++ lib/headers.c (copie de travail)
@@ -86,3 +86,32 @@
}
return p;
}
+
+
+/*
+** Skip any amount of FWS (folding whitespace), the RFC 5322 grammar term
+** for whitespace and CRLF pairs. We also allow simple newlines since we don't
+** always deal with wire-format messages. Note that we do not attempt to
+** ensure that CRLF or a newline is followed by whitespace. Returns the new
+** position of the pointer.
+*/
+const char *
+skip_fws(const char *p)
+{
+ for (; *p != '\0'; p++) {
+ switch (*p) {
+ case ' ':
+ case '\t':
+ case '\n':
+ break;
+ case '\r':
+ if (p[1] != '\n')
+ return p;
+ break;
+ default:
+ return p;
+ }
+ }
+ return p;
+}
+
>>> Why did we accept such an article to begin with?
>>
>> Because not all injecting agents enforce such rules.
>> Not all injecting agents are (and probably will be) compliant with RFC 5537.
>
> Did RFC 1036 say differently? If not, then these have been errors for 22
> years.
RFC 1036 did not go as deep as RFC 5537 does regarding the duties of
all the agents involved in Netnews. In particular here, the injecting agents.
--
Julien ÉLIE
« Les mathématiques peuvent être définies comme une science
dans laquelle on ne sait jamais de quoi on parle, ni si ce qu'on dit
est vrai. » (Bertrand Russell)
Re: unrelated possible bug with C flag?
Author: D. Stussy
Date: Sun, 31 Jan 2010 07:46
Date: Sun, 31 Jan 2010 07:46
131 lines
5924 bytes
5924 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:hk23qr$dok$1@news.trigofacile.com...
> > I thought that's what I did in my proposal earlier....
> >
> > i = number of groups, NOT number of commas. Therefore poster => i=1.
>
> Then the (complete) patch is the following:
Your patch is still wrong. From the loop, variable "i" should be able to
assume the value of zero if the data field of the "Followup-To:" header is
empty or not specified.
Look at my solution. It accounts for that possibility.
> Index: include/inn/libinn.h
> ===================================================================
> --- include/inn/libinn.h (révision 8880)
> +++ include/inn/libinn.h (copie de travail)
> @@ -157,6 +157,7 @@
> extern bool IsValidMessageID(const char *string, bool
stripspaces);
> extern bool IsValidHeaderName(const char *string);
> extern const char * skip_cfws(const char *p);
> +extern const char * skip_fws(const char *p);
> extern void HeaderCleanFrom(char *from);
> extern struct _DDHANDLE * DDstart(FILE *FromServer, FILE *ToServer);
> extern void DDcheck(struct _DDHANDLE *h, char *group);
> Index: innd/art.c
> ===================================================================
> --- innd/art.c (révision 8911)
> +++ innd/art.c (copie de travail)
> @@ -2159,13 +2159,25 @@
> }
>
> if (HDR_FOUND(HDR__FOLLOWUPTO)) {
> - for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; (p = strchr(p, ',')) != NULL
;
> - i++, p++)
> - continue;
> + for (i = 1, p = HDR(HDR__FOLLOWUPTO) ; (p = strchr(p, ',')) != NULL
;
> + i++, p++) ;
> +
> data->Followcount = i;
> +
> + /* When "poster" is the only value, then it is not a followup. */
> + if (i == 1) {
> + /* Skip leading whitespaces. */
> + p = (char *) skip_fws(HDR(HDR__FOLLOWUPTO));
> +
> + if (strncasecmp(p, "poster", 6) == 0
> + && (p[6] == ' ' || p[6] == '\t' || p[6] == '\0'
> + || p[6] == '\r' || p[6] == '\n')) {
> + data->Followcount = 0;
> + }
> + }
> + } else {
> + data->Followcount = data->Groupcount;
> }
> - if (data->Followcount == 0)
> - data->Followcount = data->Groupcount;
>
> groups = data->Newsgroups.List;
> /* Parse the Control header. */
> Index: lib/headers.c
> ===================================================================
> --- lib/headers.c (révision 8880)
> +++ lib/headers.c (copie de travail)
> @@ -86,3 +86,32 @@
> }
> return p;
> }
> +
> +
> +/*
> +** Skip any amount of FWS (folding whitespace), the RFC 5322 grammar
term
> +** for whitespace and CRLF pairs. We also allow simple newlines since
we don't
> +** always deal with wire-format messages. Note that we do not attempt
to
> +** ensure that CRLF or a newline is followed by whitespace. Returns
the new
> +** position of the pointer.
> +*/
> +const char *
> +skip_fws(const char *p)
> +{
> + for (; *p != '\0'; p++) {
> + switch (*p) {
> + case ' ':
> + case '\t':
> + case '\n':
> + break;
> + case '\r':
> + if (p[1] != '\n')
> + return p;
> + break;
> + default:
> + return p;
> + }
> + }
> + return p;
> +}
> +
>
>
>
> >>> Why did we accept such an article to begin with?
> >>
> >> Because not all injecting agents enforce such rules.
> >> Not all injecting agents are (and probably will be) compliant with RFC
5537.
> >
> > Did RFC 1036 say differently? If not, then these have been errors for
22
> > years.
>
> RFC 1036 did not go as deep as RFC 5537 does regarding the duties of
> all the agents involved in Netnews. In particular here, the injecting
agents.
>
> --
> Julien ÉLIE
>
> « Les mathématiques peuvent être définies comme une science
> dans laquelle on ne sait jamais de quoi on parle, ni si ce qu'on dit
> est vrai. » (Bertrand Russell)
>
Re: unrelated possible bug with C flag?
Author: Julien ÉLIE
Date: Sun, 31 Jan 2010 09:49
Date: Sun, 31 Jan 2010 09:49
67 lines
4457 bytes
4457 bytes
Hi Dieter,
>> Then the (complete) patch is the following:
>
> Your patch is still wrong. From the loop, variable "i" should be able to
> assume the value of zero if the data field of the "Followup-To:" header is
> empty or not specified.
Gosh! I still do not understand at all your position on that subject.
When I suggest a patch that finds out 0 for "Followup-To: , "
or "Followup-To: , , " you disagree because I should not check the
syntax and you tell me the article is bad and should not have been
injected.
So I changed the patch not to properly parse that syntax and find the
real number of newsgroups.
And now, you tell me that the patch is wrong and should find out 0 for
"Followup-To: ", that is to say an EMPTY header field.
Yet, RFC 5536 explicitly states:
o Every line of a header field body (including the first and any
that are subsequently folded) MUST contain at least one non-
whitespace character.
So you *do* want to check the syntax here.
> Look at my solution. It accounts for that possibility.
I do not understand why you want to explicitly account for that
possibility and not all the others. You usually tell me the article
should not have been injected in the system and is bad...
Last but not least, if I look at your solution:
if (HDR_FOUND(HDR__FOLLOWUPTO)) {
for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; p != NULL ; i++)
p = strchr( ++p, ',');
[...]
it does not work the way you say it works.
i++ is executed at the end of the expression so you will have i=1
for an empty header field body.
In fact, the code you suggest is exactly the same as the one we
already had except for the fact that it adds the possibility of
a read beyond our allocated memory (look at your ++p if *p is '\0'
for an empty header field -- the variable might be set to an empty
string if the header exists and is empty).
Note that I have not checked whether the variable can actually have
this "\0" value. Maybe it is not set at all (NULL) so the code
would here be fine. But it is better not to use ++p to prevent
the code from breaking in the future.
--
Julien ÉLIE
« Les mathématiques peuvent être définies comme une science
dans laquelle on ne sait jamais de quoi on parle, ni si ce qu'on dit
est vrai. » (Bertrand Russell)
Re: unrelated possible bug with C flag?
Author: D. Stussy
Date: Sun, 31 Jan 2010 23:44
Date: Sun, 31 Jan 2010 23:44
106 lines
6237 bytes
6237 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:hk3jns$rf1$1@news.trigofacile.com...
> >> Then the (complete) patch is the following:
> >
> > Your patch is still wrong. From the loop, variable "i" should be able
to
> > assume the value of zero if the data field of the "Followup-To:" header
is
> > empty or not specified.
>
> Gosh! I still do not understand at all your position on that subject.
The SOLE purpose of this routine snippet is to count followup groups. Such
is post-acceptance processing of an article for distribution to peers.
What I keep questioning is why you try to do syntax checking on an
already-accepted article.
> When I suggest a patch that finds out 0 for "Followup-To: , "
> or "Followup-To: , , " you disagree because I should not check the
> syntax and you tell me the article is bad and should not have been
> injected.
> So I changed the patch not to properly parse that syntax and find the
> real number of newsgroups.
>
> And now, you tell me that the patch is wrong and should find out 0 for
> "Followup-To: ", that is to say an EMPTY header field.
Why not? How many groups do you see there? I see ZERO.
> Yet, RFC 5536 explicitly states:
>
> o Every line of a header field body (including the first and any
> that are subsequently folded) MUST contain at least one non-
> whitespace character.
>
> So you *do* want to check the syntax here.
Completely WRONG. I do NOT want to check syntax here because INN has
ALREADY ACCEPTED the article, and as such, I assume that it is already
syntactically correct. Syntax checking should be performed BEFORE article
acceptance.
> > Look at my solution. It accounts for that possibility.
>
> I do not understand why you want to explicitly account for that
> possibility and not all the others. You usually tell me the article
> should not have been injected in the system and is bad...
Because it has different treatment: NOT having a "Followup-To:" header (or
the header with empty data) is equivalent to using the "Newsgroups:" header
in its place. As we've already parsed and counted the groups, we simply
copy that result into the followup count.
> Last but not least, if I look at your solution:
>
> if (HDR_FOUND(HDR__FOLLOWUPTO)) {
> for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; p != NULL ; i++)
> p = strchr( ++p, ',');
> [...]
>
> it does not work the way you say it works.
> i++ is executed at the end of the expression so you will have i=1
> for an empty header field body.
No, I won't - because P == NULL on the first conditional check. The HDR
routine should be returning a whitespace-trimmed copy of the header data.
The single space following the colon is NOT part of the data field but part
of the field separator from the header name. The syntax says _header_name_
": " _header_data_ - that is: NAME COLON SPACE DATA.
Results:
Header not present -> i=0; [HDR() = NULL]
Header empty -> i=0 [HDR() = NULL]
Header has no commas -> i=1 [HDR() != NULL]
Header with commas -> i = #_of_commas + 1 [HDR() != NULL]
Such is exactly the result we want.
"Poster" with its special meaning occurs ONLY when i = 1. It cannot occur
with i=0. Should it occur with i >=2, then we have a syntax error that
should have caused rejection of the article; therefore, it never reaches
the above code and we need not consider it.
> In fact, the code you suggest is exactly the same as the one we
> already had except for the fact that it adds the possibility of
> a read beyond our allocated memory (look at your ++p if *p is '\0'
> for an empty header field -- the variable might be set to an empty
> string if the header exists and is empty).
It's more correct than what you offered, as you compute the wrong value of
"i" for at least one case.
How can *p =0? Only if we have "...," (a comma at the end of the string) -
a syntax error, so it will never occur since we will not reach this point
with a rejected article.
> Note that I have not checked whether the variable can actually have
> this "\0" value. Maybe it is not set at all (NULL) so the code
> would here be fine. But it is better not to use ++p to prevent
> the code from breaking in the future.
Why? If the comma is found, we KNOW that the next character is NOT the end
of the string (because, if it were, the article would have been rejected).
Re: unrelated possible bug with C flag?
Author: Julien ÉLIE
Date: Mon, 01 Feb 2010 07:17
Date: Mon, 01 Feb 2010 07:17
53 lines
3873 bytes
3873 bytes
Hi Dieter, > I do NOT want to check syntax here because INN has > ALREADY ACCEPTED the article, and as such, I assume that it is already > syntactically correct. Syntax checking should be performed BEFORE article > acceptance. A relaying agent is NOT REQUIRED to reject articles because of their syntax. It is only a MAY, and innd definitely does not reject an article based on a wrong syntax of the Followup-To: header field. >> In fact, the code you suggest is exactly the same as the one we >> already had except for the fact that it adds the possibility of >> a read beyond our allocated memory (look at your ++p if *p is '\0' >> for an empty header field -- the variable might be set to an empty >> string if the header exists and is empty). > > It's more correct than what you offered, as you compute the wrong value of > "i" for at least one case. Case that is easy to take into account: - if (strncasecmp(p, "poster", 6) == 0 + if (*p == '\0' || (strncasecmp(p, "poster", 6) == 0 with closing parenthesis afterwards. > How can *p =0? Only if we have "...," (a comma at the end of the string) - > a syntax error, so it will never occur since we will not reach this point > with a rejected article. If you think that the Followup-To: header field can never end with a comma, then please patch your INN with your suggested patch, and I will happily inject in Usenet articles whose Followup-To: header fields end with commas. > Why? If the comma is found, we KNOW that the next character is NOT the end > of the string (because, if it were, the article would have been rejected). "we KNOW"? :-) -- Julien ÉLIE « -- Nous parlerons quand l'interprète dormira. [Bong !] -- Il dort. On peut parler. » (Astérix)
Page 2 of 2 • 70 total messages
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