Problems with INN-2.2.3 and SuSE6.4
Dr. Christian Renner
stooge at josua.ithnet.com
Tue Dec 19 09:57:01 UTC 2000
Hello,
sorry for being a nuisance, really.
Out of need: there is no one who could patch an INN-2.3.0 or 2.2.3 for me
accordingly, is there?
Kind regards
Christian
On Tue, Dec 12, 2000 at 02:18:13PM -0500, Michael Stassen wrote:
>
> Note that the descriptions in the comments do not match the actions taken
> in the code. That is, the check for 4-digits in the if is actually a
> check for 3 digits, and the ugly function in the else does not add
> 1900. This should be our first clue...
>
> I believe this is a Y2K bug introduced to fix a Y2K bug...
>
> As I understand it, there are two separate problems to account for:
>
> 1) NNTP specifies two digits for the year (clearly a problem), but many
> servers and clients ignore this and use 4 digits (sensible). INN
> should correctly handle either case.
>
> 2) A common programming mistake is (was?) to assume that tm->tm_year is
> the two digit year, rather than the years since 1900. Hence, some
> programs get 100 for 2000, 101 for 2001, etc. Arguably, INN should
> handle this as well.
>
> I believe the ugly function in the else is an attempt to apply the
> "window" solution to the two-digit year problem. That is, if $4 is in the
> range 50 to 99, we assume 19xx, but if $4 is in the range 00 to 49, we
> assume 20xx. The formula given, however, doesn't get this right unless
> yyYear = 1999. For example, if yyYear = 2000, values of $4 in the range
> 01 to 50 become 19xx and values of $4 in the range 51 to 99 become 18xx.
> Only $4 = 00 correctly translates to 2000 when yyYear is 2000!
>
> I suspect it would be preferable to have the code explicitly match the
> intent. Also, as a practical matter, I assume there is no reason for INN
> to believe $4 is less than 1970, so 70 might be a better window cutoff
> than 50. Assuming I've correctly diagnosed the intent, here's my
> suggested replacement:
>
> if ($4 > 999) /* in practice, $4 >1969 would be just as good */
> {
> /* $4 is YYYY, use as is */
> yyYear = $4;
> }
> else if ($4 < 70)
> {
> /* $4 is YY in the range 00 to 69, assume 20xx */
> yyYear = 2000 + $4;
> }
> else
> {
> /* $4 is either YY in the range 70 to 99, or YYY (we assume 1YY),
> so add 1900 */
> yyYear = 1900 + $4;
> }
>
> Of course, this doesn't handle pathological cases ($4 < 0 or $4 = 765,
> say), but then neither does the code to be replaced. I assume that's
> handled elsewhere? Also, when 2070 rolls around, this code will treat 70
> as 1970 instead of 2070, but the assumption of the window solution is that
> by then we will either no longer be receiving 2 digit years, or we will
> move the window forward (or we won't be using this code).
>
> Michael Stassen
> Support Center
> University Information Technology Services
> Indiana University Bloomington
> stassenm at indiana.edu
>
>
> On 10 Dec 2000, Russ Allbery wrote:
>
> >
> > Christian Renner <stooge at josua.ithnet.com> writes:
> >
> > > Any idea: is there any chance of making INN 2.2.3 or above accept news
> > > that come with a date header of "8 Dec 100 21:39:00 +0100" ???
> >
> > Hm. Looking at parsedate.y in 2.3, there are actually a whole bunch of
> > places that should be handling this:
> >
> > if ($4 > 100) {
> > /* assume year is YYYY format, so need not to add 1900 */
> > yyYear = $4;
> > } else {
> > /* assume year is YY format, so need to add 1900 */
> > yyYear = $4 + (yyYear / 100 + (yyYear % 100 - $4) / 50) * 100;
> > }
> >
> > I'm not sure why it's not doing what you want. Hurm. Although I also
> > have no idea what that formula is really doing, since it's not obviously
> > just adding 1900.
> >
> > --
> > Russ Allbery (rra at stanford.edu) <http://www.eyrie.org/~eagle/>
> >
> >
>
>
>
>
---end quoted text---
--
Dr. med. Christian J. Renner aka cjrenner at well.com
http://www.franken.de/users/daneel/C.Renner/index.html
Cellphone:(+49 171)7042580 - Phone:(+49 991)3792388
Workphone:(+49 991)31450 - IRC: Marchal - pgp-key upon request
More information about the inn-workers
mailing list