INN commit: trunk (9 files)

INN Commit rra at isc.org
Mon Oct 26 20:26:04 UTC 2015


    Date: Monday, October 26, 2015 @ 13:26:04
  Author: iulius
Revision: 9958

Use -0000 instead of +0000 as the time zone in generated headers not at Universal Time

nnrpd now uses -0000 as the time zone for Date: and Injection-Date:
header fields it generates.  It was previously using +0000, wrongly
systematically indicating a local time zone at Universal Time when
the localtime paramater is set to false (which is the default) in
readers.conf.  The +0000 time zone will now be used only if localtime
is set to true and UTC is really the local time zone of the server.

Improve the documentation of readers.conf, mentioning a use case for
the localtime parameter.  Thanks to Russ for it.

convdate now similarly also uses -0000.

Modified:
  trunk/doc/pod/active.times.pod
  trunk/doc/pod/convdate.pod
  trunk/doc/pod/grephistory.pod
  trunk/doc/pod/news.pod
  trunk/doc/pod/readers.conf.pod
  trunk/lib/date.c
  trunk/nnrpd/post.c
  trunk/tests/lib/date-t.c
  trunk/tests/util/convdate.t

--------------------------+
 doc/pod/active.times.pod |    2 +-
 doc/pod/convdate.pod     |    2 +-
 doc/pod/grephistory.pod  |    2 +-
 doc/pod/news.pod         |    9 +++++++++
 doc/pod/readers.conf.pod |   15 +++++++++++----
 lib/date.c               |    7 +++++--
 nnrpd/post.c             |    4 +++-
 tests/lib/date-t.c       |    6 +++---
 tests/util/convdate.t    |    2 +-
 9 files changed, 35 insertions(+), 14 deletions(-)

Modified: doc/pod/active.times.pod
===================================================================
--- doc/pod/active.times.pod	2015-10-26 20:11:37 UTC (rev 9957)
+++ doc/pod/active.times.pod	2015-10-26 20:26:04 UTC (rev 9958)
@@ -33,7 +33,7 @@
 
 shows that the newsgroup news.admin.moderation was created on April 4th, 2007,
 at 20:00:03 UTC.  This date can be obtained for instance with
-C<convdate -c 1175716803> (convdate(1) is shipped with INN) or
+C<convdate -dc 1175716803> (convdate(1) is shipped with INN) or
 C<date -u -d "Jan 1, 1970 00:00:00 +0000 + 1175716803 seconds">.  It is
 when the newsgroup was locally created; in this example, it is when a
 control message sent by C<group-admin at isc.org> was received and processed

Modified: doc/pod/convdate.pod
===================================================================
--- doc/pod/convdate.pod	2015-10-26 20:11:37 UTC (rev 9957)
+++ doc/pod/convdate.pod	2015-10-26 20:26:04 UTC (rev 9958)
@@ -78,7 +78,7 @@
 ctime(3) results are in the local time zone.  Compare to:
 
     % convdate -dc 666198000
-    Sun, 10 Feb 1991 15:00:00 +0000 (UTC)
+    Sun, 10 Feb 1991 15:00:00 -0000 (UTC)
 
     % env TZ=PST8PDT convdate -dlc 666198000
     Sun, 10 Feb 1991 07:00:00 -0800 (PST)

Modified: doc/pod/grephistory.pod
===================================================================
--- doc/pod/grephistory.pod	2015-10-26 20:11:37 UTC (rev 9957)
+++ doc/pod/grephistory.pod	2015-10-26 20:26:04 UTC (rev 9958)
@@ -103,7 +103,7 @@
     Date: Mon, 08 Jun 2009 20:25:12 -0700
 
     % convdate -dc 1244517912
-    Tue, 9 Jun 2009 03:25:12 +0000 (UTC)
+    Tue, 9 Jun 2009 03:25:12 -0000 (UTC)
 
 It matches the number recorded in history as for its posting date.
 

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2015-10-26 20:11:37 UTC (rev 9957)
+++ doc/pod/news.pod	2015-10-26 20:26:04 UTC (rev 9958)
@@ -4,6 +4,15 @@
 
 =item *
 
+B<nnrpd> now uses C<-0000> as the time zone for Date: and Injection-Date:
+header fields it generates.  It was previously using C<+0000>, wrongly
+systematically indicating a local time zone at Universal Time when
+I<localtime> is set to false (which is the default) in F<readers.conf>.
+The C<+0000> time zone will now be used only if I<localtime> is set to
+true and UTC is really the local time zone of the server.
+
+=item *
+
 When an encryption layer is negotiated after a successful use of the
 STARTTLS command, or after a successful authentication using a SASL
 mechanism which negotiates an encrypted layer, B<nnrpd> now updates

Modified: doc/pod/readers.conf.pod
===================================================================
--- doc/pod/readers.conf.pod	2015-10-26 20:11:37 UTC (rev 9957)
+++ doc/pod/readers.conf.pod	2015-10-26 20:26:04 UTC (rev 9958)
@@ -510,11 +510,18 @@
 
 =item B<localtime:>
 
-If a Date: header is not included in a posted article, nnrpd(8) normally
-adds a new Date: header in UTC.  If this is set to true, the Date: header
-will be formatted in local time instead.  This is a boolean value and the
-default is false.
+If a Date: or an Injection-Date: header field is not included in a
+posted article, nnrpd(8) normally adds these header fields in UTC.
+If this is set to true, the Date: header field will be formatted in
+local time instead.  (The Injection-Date: header field will remain in
+UTC, though.)  This is a boolean value and the default is false.
 
+This parameter permits to handle a relatively unusual corner case.
+It is mostly a tool for people who I<want> to disclose their local time
+zone (it can be useful information in certain types of discussions),
+but whose clients don't for some reason, and who can arrange for the
+server to be in the same time zone as the client.
+
 =item B<newsmaster:>
 
 Used as the contact address in the help message returned by nnrpd(8), if

Modified: lib/date.c
===================================================================
--- lib/date.c	2015-10-26 20:11:37 UTC (rev 9957)
+++ lib/date.c	2015-10-26 20:26:04 UTC (rev 9958)
@@ -210,7 +210,7 @@
 
                     1         2         3
            1234567890123456789012345678901
-           Sat, 31 Aug 2002 23:45:18 +0000
+           Sat, 31 Aug 2002 23:45:18 -0000
 
        31 characters, plus another character for the trailing nul.  The buffer
        will need to have at least another six characters of space to get the
@@ -236,7 +236,10 @@
     } else {
         tmp_tm = gmtime(&realdate);
         tm = *tmp_tm;
-        tz_sign = 1;
+        /* Use "-0000" to indicate that the time was generated on a system
+           that may be in a local time zone other than Universal Time and
+           therefore contains no information about the local time zone.*/
+        tz_sign = -1;
         tz_hour_offset = 0;
         tz_min_offset = 0;
     }

Modified: nnrpd/post.c
===================================================================
--- nnrpd/post.c	2015-10-26 20:11:37 UTC (rev 9957)
+++ nnrpd/post.c	2015-10-26 20:26:04 UTC (rev 9958)
@@ -352,7 +352,9 @@
     now = time(NULL);
 
     /* datebuff is used for both Injection-Date: and Date: header fields
-     * so we have to set it now, and it has to be the UTC date. */
+     * so we have to set it now, and it has to be the UTC date (unless
+     * for the Date: header field if localtime is set to true
+     * in readers.conf). */
     if (!makedate(-1, false, datebuff, sizeof(datebuff)))
         return "Can't generate Date: header";
 

Modified: tests/lib/date-t.c
===================================================================
--- tests/lib/date-t.c	2015-10-26 20:11:37 UTC (rev 9957)
+++ tests/lib/date-t.c	2015-10-26 20:26:04 UTC (rev 9958)
@@ -185,13 +185,13 @@
 
     status = makedate(100000000UL, false, buff, sizeof(buff));
     ok(3, status);
-    ok_string(4, "Sat, 3 Mar 1973 09:46:40 +0000 (UTC)", buff);
+    ok_string(4, "Sat, 3 Mar 1973 09:46:40 -0000 (UTC)", buff);
     status = makedate(100000000UL, true, buff, sizeof(buff));
     ok(5, status);
     ok_string(6, "Sat, 3 Mar 1973 01:46:40 -0800 (PST)", buff);
     status = makedate(300000000UL, false, buff, sizeof(buff));
     ok(7, status);
-    ok_string(8, "Thu, 5 Jul 1979 05:20:00 +0000 (UTC)", buff);
+    ok_string(8, "Thu, 5 Jul 1979 05:20:00 -0000 (UTC)", buff);
     status = makedate(300000000UL, true, buff, sizeof(buff));
     ok(9, status);
     ok_string(10, "Wed, 4 Jul 1979 22:20:00 -0700 (PDT)", buff);
@@ -200,7 +200,7 @@
     ok(11, !status);
     status = makedate(300000000UL, false, buff, 32);
     ok(12, status);
-    ok_string(13, "Thu, 5 Jul 1979 05:20:00 +0000", buff);
+    ok_string(13, "Thu, 5 Jul 1979 05:20:00 -0000", buff);
     status = makedate(300000000UL, true, buff, 32);
     ok(14, status);
     ok_string(15, "Wed, 4 Jul 1979 22:20:00 -0700", buff);

Modified: tests/util/convdate.t
===================================================================
--- tests/util/convdate.t	2015-10-26 20:11:37 UTC (rev 9957)
+++ tests/util/convdate.t	2015-10-26 20:26:04 UTC (rev 9958)
@@ -47,7 +47,7 @@
     '666198000
 641880000'
 compare "`$convdate -c 666198000`" 'Sun Feb 10 10:00:00 1991'
-compare "`$convdate -dc 666198000`" 'Sun, 10 Feb 1991 15:00:00 +0000 (UTC)'
+compare "`$convdate -dc 666198000`" 'Sun, 10 Feb 1991 15:00:00 -0000 (UTC)'
 compare "`env TZ=PST8PDT $convdate -dlc 666198000`" \
     'Sun, 10 Feb 1991 07:00:00 -0800 (PST)'
 compare "`env TZ=EST5EDT $convdate -dlc 666198000`" \



More information about the inn-committers mailing list