Upstream patch: add support for the Tzif3 timezone files

(syslog-ng-3.5.3-support-Tzif3-format-timezone-files.patch)
This commit is contained in:
Jose Pedro Oliveira 2014-02-22 17:44:12 +00:00
parent f7f717bdac
commit 92dac5fda9
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,52 @@
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

View File

@ -3,7 +3,7 @@
Name: syslog-ng
Version: 3.5.3
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Next-generation syslog server
Group: System Environment/Daemons
@ -16,6 +16,7 @@ Source2: syslog-ng.logrotate
Patch0: syslog-ng-3.5.0-syslog-ng.service.patch
Patch1: syslog-ng-3.4.0beta1-tests-functional-control.py.patch
Patch2: syslog-ng-3.3.6-tests-functional-sql-test.patch
Patch3: syslog-ng-3.5.3-support-Tzif3-format-timezone-files.patch
BuildRequires: systemd-units
BuildRequires: pkgconfig
@ -120,6 +121,7 @@ developing applications that use %{name}.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
# fix perl path
%{__sed} -i 's|^#!/usr/local/bin/perl|#!%{__perl}|' contrib/relogger.pl
@ -301,6 +303,10 @@ fi
%changelog
* Sat Feb 22 2014 Jose Pedro Oliveira <jpo at di.uminho.pt> - 3.5.3-4
- Upstream patch: add support for the Tzif3 timezone files
(syslog-ng-3.5.3-support-Tzif3-format-timezone-files.patch)
* Tue Feb 11 2014 Matthias Runge <mrunge@redhat.com> - 3.5.3-3
- rebuild due libdbi bump