92dac5fda9
(syslog-ng-3.5.3-support-Tzif3-format-timezone-files.patch)
53 lines
2.1 KiB
Diff
53 lines
2.1 KiB
Diff
From 45d3aabe1c5ae6f9b1bca045407ee68ec46e3da6 Mon Sep 17 00:00:00 2001
|
|
From: Gergely Nagy <algernon@balabit.hu>
|
|
Date: Fri, 21 Feb 2014 12:51:59 +0100
|
|
Subject: [PATCH] timeutils: Support Tzif3 format timezone files too
|
|
|
|
The latest tzdata release added a new tzif version, with some minor
|
|
changes. This patch adds support for the format to our zone info parser,
|
|
and fixes #86.
|
|
|
|
Reported-by: Peter Czanik <czanik@balabit.hu>
|
|
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
|
|
---
|
|
lib/timeutils.c | 11 ++++++++---
|
|
1 file changed, 8 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/lib/timeutils.c b/lib/timeutils.c
|
|
index 38cbafd..2984d3f 100644
|
|
--- a/lib/timeutils.c
|
|
+++ b/lib/timeutils.c
|
|
@@ -576,7 +576,7 @@ zone_info_parser(unsigned char **input, gboolean is64bitData, gint *version)
|
|
* if '\0', we have just one copy of data,
|
|
* if '2', there is additional 64 bit version at the end.
|
|
*/
|
|
- if (buf[0] != 0 && buf[0] != '2')
|
|
+ if (buf[0] != 0 && buf[0] != '2' && buf[0] != '3')
|
|
{
|
|
msg_error("Error in the time zone file",
|
|
evt_tag_str("message", "Bad Olson version info"),
|
|
@@ -657,13 +657,18 @@ zone_info_parser(unsigned char **input, gboolean is64bitData, gint *version)
|
|
/* Read types (except for the isstd and isgmt flags, which come later (why??)) */
|
|
for (i = 0; i<typecnt; ++i)
|
|
{
|
|
+ gint offs = 24;
|
|
+
|
|
+ if (*version == 3)
|
|
+ offs = 167;
|
|
+
|
|
gmt_offsets[i] = readcoded32(input, G_MININT64, G_MAXINT64);
|
|
- if (gmt_offsets[i] > 24 * 60 * 60 || gmt_offsets[i] < -1 * 24 * 60 * 60)
|
|
+ if (gmt_offsets[i] > offs * 60 * 60 || gmt_offsets[i] < -1 * offs * 60 * 60)
|
|
{
|
|
msg_warning("Error in the time zone file",
|
|
evt_tag_str("message", "Illegal gmtoffset number"),
|
|
evt_tag_int("val", gmt_offsets[i]),
|
|
- evt_tag_printf("expected", "[%d, %d]", -1 * 24 * 60 * 60, 24 * 60 * 60),
|
|
+ evt_tag_printf("expected", "[%d, %d]", -1 * offs * 60 * 60, offs * 60 * 60),
|
|
NULL);
|
|
goto error;
|
|
}
|
|
--
|
|
1.8.5.4
|
|
|