From 40f388f6d932919abc3ac00820fdf3aa990896e7 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 05 2015 13:06:54 +0000 Subject: import hivex-1.3.10-5.7.el7 --- diff --git a/.gitignore b/.gitignore index afde176..eed41cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/hivex-1.3.8.tar.gz +SOURCES/hivex-1.3.10.tar.gz diff --git a/.hivex.metadata b/.hivex.metadata index da0f8b5..b9989e3 100644 --- a/.hivex.metadata +++ b/.hivex.metadata @@ -1 +1 @@ -9f8944df2cd1f77776a7c3c11ad02728c4a52878 SOURCES/hivex-1.3.8.tar.gz +daf22b5301d4dfdf44cfff326b67c8690ef73509 SOURCES/hivex-1.3.10.tar.gz diff --git a/SOURCES/0001-generator-Fix-a-spelling-mistake-in-the-documentatio.patch b/SOURCES/0001-generator-Fix-a-spelling-mistake-in-the-documentatio.patch new file mode 100644 index 0000000..dc8ed8e --- /dev/null +++ b/SOURCES/0001-generator-Fix-a-spelling-mistake-in-the-documentatio.patch @@ -0,0 +1,50 @@ +diff -ur hivex-1.3.10.old/generator/generator.ml hivex-1.3.10/generator/generator.ml +--- hivex-1.3.10.old/generator/generator.ml 2014-03-26 14:56:27.000000000 +0000 ++++ hivex-1.3.10/generator/generator.ml 2014-11-17 11:53:46.469958904 +0000 +@@ -242,7 +242,7 @@ + "\ + Return the length of the key (name) of a (key, value) pair as produced + by C. The length can legitimately be 0, so errno is +-the necesary mechanism to check for errors. ++the necessary mechanism to check for errors. + + In the context of Windows Registries, a zero-length name means + that this value is the default key for this node in the tree. +diff -ur hivex-1.3.10.old/lib/hivex.pod hivex-1.3.10/lib/hivex.pod +--- hivex-1.3.10.old/lib/hivex.pod 2014-01-10 10:00:53.000000000 +0000 ++++ hivex-1.3.10/lib/hivex.pod 2014-11-17 11:53:49.288886768 +0000 +@@ -346,7 +346,7 @@ + + Return the length of the key (name) of a (key, value) pair as produced + by C. The length can legitimately be 0, so errno is +-the necesary mechanism to check for errors. ++the necessary mechanism to check for errors. + + In the context of Windows Registries, a zero-length name means + that this value is the default key for this node in the tree. +diff -ur hivex-1.3.10.old/perl/lib/Win/Hivex.pm hivex-1.3.10/perl/lib/Win/Hivex.pm +--- hivex-1.3.10.old/perl/lib/Win/Hivex.pm 2014-01-10 10:00:53.000000000 +0000 ++++ hivex-1.3.10/perl/lib/Win/Hivex.pm 2014-11-17 11:53:49.337885514 +0000 +@@ -212,7 +212,7 @@ + + Return the length of the key (name) of a (key, value) pair as produced + by C. The length can legitimately be 0, so errno is +-the necesary mechanism to check for errors. ++the necessary mechanism to check for errors. + + In the context of Windows Registries, a zero-length name means + that this value is the default key for this node in the tree. +diff -ur hivex-1.3.10.old/ruby/ext/hivex/_hivex.c hivex-1.3.10/ruby/ext/hivex/_hivex.c +--- hivex-1.3.10.old/ruby/ext/hivex/_hivex.c 2014-01-13 22:20:34.000000000 +0000 ++++ hivex-1.3.10/ruby/ext/hivex/_hivex.c 2014-11-17 11:53:50.808847877 +0000 +@@ -580,8 +580,8 @@ + * + * Return the length of the key (name) of a (key, value) + * pair as produced by "h.value_key". The length can +- * legitimately be 0, so errno is the necesary mechanism to +- * check for errors. ++ * legitimately be 0, so errno is the necessary mechanism ++ * to check for errors. + * + * In the context of Windows Registries, a zero-length name + * means that this value is the default key for this node diff --git a/SOURCES/0001-handle-Refuse-to-open-files-8192-bytes-in-size.patch b/SOURCES/0001-handle-Refuse-to-open-files-8192-bytes-in-size.patch new file mode 100644 index 0000000..ac5dbf6 --- /dev/null +++ b/SOURCES/0001-handle-Refuse-to-open-files-8192-bytes-in-size.patch @@ -0,0 +1,35 @@ +From 357f26fa64fd1d9ccac2331fe174a8ee9c607adb Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 30 Oct 2014 13:50:39 +0000 +Subject: [PATCH 1/2] handle: Refuse to open files < 8192 bytes in size. + +These cannot be valid hives, since they don't contain a full header +page and at least a single page of data (in other words they couldn't +contain a root node). + +Thanks: Mahmoud Al-Qudsi +--- + lib/handle.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/lib/handle.c b/lib/handle.c +index 62a8644..a3cbcf7 100644 +--- a/lib/handle.c ++++ b/lib/handle.c +@@ -104,6 +104,13 @@ hivex_open (const char *filename, int flags) + + h->size = statbuf.st_size; + ++ if (h->size < 0x2000) { ++ SET_ERRNO (EINVAL, ++ "%s: file is too small to be a Windows NT Registry hive file", ++ filename); ++ goto error; ++ } ++ + if (!h->writable) { + h->addr = mmap (NULL, h->size, PROT_READ, MAP_SHARED, h->fd, 0); + if (h->addr == MAP_FAILED) +-- +2.1.0 + diff --git a/SOURCES/0001-lib-Don-t-leak-errno-from-_hivex_recode-function.patch b/SOURCES/0001-lib-Don-t-leak-errno-from-_hivex_recode-function.patch new file mode 100644 index 0000000..24ece49 --- /dev/null +++ b/SOURCES/0001-lib-Don-t-leak-errno-from-_hivex_recode-function.patch @@ -0,0 +1,33 @@ +From 4b3c3cd2b3d8d34601979feeb1390fddd442ab04 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 20 Nov 2014 21:37:19 +0000 +Subject: [PATCH] lib: Don't leak errno from _hivex_recode function. + +If iconv returns E2BIG, that's an internal indication for us, and not +an error. Don't leak the errno up to the user, as happened here: + +https://www.redhat.com/archives/libguestfs/2014-November/msg00140.html + +Thanks Nicolas Ecarnot. +--- + lib/utf16.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/lib/utf16.c b/lib/utf16.c +index fe2c3bd..238f40a 100644 +--- a/lib/utf16.c ++++ b/lib/utf16.c +@@ -58,6 +58,10 @@ _hivex_recode (const char *input_encoding, const char *input, size_t input_len, + if (r == (size_t) -1) { + if (errno == E2BIG) { + int err = errno; ++ /* Reset errno here because we don't want to accidentally ++ * return E2BIG to a library caller. ++ */ ++ errno = 0; + size_t prev = outalloc; + /* Try again with a larger output buffer. */ + free (out); +-- +2.1.0 + diff --git a/SOURCES/0001-value-Set-errno-0-on-non-error-path-in-hivex_value_d.patch b/SOURCES/0001-value-Set-errno-0-on-non-error-path-in-hivex_value_d.patch new file mode 100644 index 0000000..0344910 --- /dev/null +++ b/SOURCES/0001-value-Set-errno-0-on-non-error-path-in-hivex_value_d.patch @@ -0,0 +1,32 @@ +From 38522d66673f341f8b12a82eb070fd1ffb8e55ec Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 22 Sep 2014 15:08:44 +0100 +Subject: [PATCH 1/2] value: Set errno = 0 on non-error path in + hivex_value_data_cell_offset (RHBZ#1145056). + +hivex_value_data_cell_offset may return 0 to indicate that the data is +inline. This is not an error return, but it was possible for errno to +have a random (non-zero) value along this path. Explicitly set errno += 0 on this path. + +Thanks: Wei Shi +(cherry picked from commit 9763f96a1374486c7d00ea5c04b8048fe69e63f3) +--- + lib/value.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/value.c b/lib/value.c +index f222b41..aa80238 100644 +--- a/lib/value.c ++++ b/lib/value.c +@@ -276,6 +276,7 @@ hivex_value_data_cell_offset (hive_h *h, hive_value_h value, size_t *len) + /* There is no other location for the value data. */ + if (len) + *len = 0; ++ errno = 0; + return 0; + } else { + if (len) +-- +2.0.4 + diff --git a/SOURCES/0002-handle-Check-that-pages-do-not-extend-beyond-the-end.patch b/SOURCES/0002-handle-Check-that-pages-do-not-extend-beyond-the-end.patch new file mode 100644 index 0000000..7977e16 --- /dev/null +++ b/SOURCES/0002-handle-Check-that-pages-do-not-extend-beyond-the-end.patch @@ -0,0 +1,32 @@ +From 4bbdf555f88baeae0fa804a369a81a83908bd705 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 30 Oct 2014 14:02:25 +0000 +Subject: [PATCH 2/2] handle: Check that pages do not extend beyond the end of + the file. + +Thanks: Mahmoud Al-Qudsi +--- + lib/handle.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/lib/handle.c b/lib/handle.c +index a3cbcf7..3a8f09b 100644 +--- a/lib/handle.c ++++ b/lib/handle.c +@@ -247,6 +247,13 @@ hivex_open (const char *filename, int flags) + goto error; + } + ++ if (off + page_size > h->size) { ++ SET_ERRNO (ENOTSUP, ++ "%s: page size %zu at 0x%zx extends beyond end of file, bad registry", ++ filename, page_size, off); ++ goto error; ++ } ++ + /* Read the blocks in this page. */ + size_t blkoff; + struct ntreg_hbin_block *block; +-- +2.1.0 + diff --git a/SOURCES/0002-hivexml-Tidy-up-error-handling-and-printing.patch b/SOURCES/0002-hivexml-Tidy-up-error-handling-and-printing.patch new file mode 100644 index 0000000..0be6d03 --- /dev/null +++ b/SOURCES/0002-hivexml-Tidy-up-error-handling-and-printing.patch @@ -0,0 +1,82 @@ +From c7e6dd0f09ca43c616bb2740ec748206bee6b14f Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 22 Sep 2014 15:10:36 +0100 +Subject: [PATCH 2/2] hivexml: Tidy up error handling and printing. + +(cherry picked from commit 914d9b9a91babf0227989bc7ea00cf5e41ed7da4) +--- + xml/hivexml.c | 28 +++++++++++++--------------- + 1 file changed, 13 insertions(+), 15 deletions(-) + +diff --git a/xml/hivexml.c b/xml/hivexml.c +index a4bc7eb..b496bb6 100644 +--- a/xml/hivexml.c ++++ b/xml/hivexml.c +@@ -116,7 +116,7 @@ main (int argc, char *argv[]) + + hive_h *h = hivex_open (argv[optind], open_flags); + if (h == NULL) { +- perror (argv[optind]); ++ fprintf (stderr, "hivex_open: %s: %m\n", argv[optind]); + exit (EXIT_FAILURE); + } + +@@ -148,12 +148,12 @@ main (int argc, char *argv[]) + } + + if (hivex_visit (h, &visitor, sizeof visitor, writer, visit_flags) == -1) { +- perror (argv[optind]); ++ fprintf (stderr, "hivex_visit: %s: %m\n", argv[optind]); + exit (EXIT_FAILURE); + } + + if (hivex_close (h) == -1) { +- perror (argv[optind]); ++ fprintf (stderr, "hivex_close: %s: %m\n", argv[optind]); + exit (EXIT_FAILURE); + } + +@@ -217,12 +217,9 @@ node_byte_runs (hive_h *h, void *writer_v, hive_node_h node) + { + xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v; + char buf[1+BYTE_RUN_BUF_LEN]; +- errno = 0; + size_t node_struct_length = hivex_node_struct_length (h, node); +- if (errno) { +- if (errno == EINVAL) { +- fprintf (stderr, "node_byte_runs: Invoked on what does not seem to be a node (%zu).\n", node); +- } ++ if (node_struct_length == 0) { ++ fprintf (stderr, "node_byte_runs: hivex_node_struct_length: %m\n"); + return -1; + } + /* A node has one byte run. */ +@@ -301,17 +298,18 @@ value_byte_runs (hive_h *h, void *writer_v, hive_value_h value) { + xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v; + char buf[1+BYTE_RUN_BUF_LEN]; + size_t value_data_cell_length; +- errno = 0; + size_t value_data_structure_length = hivex_value_struct_length (h, value); +- if (errno != 0) { +- if (errno == EINVAL) { +- fprintf (stderr, "value_byte_runs: Invoked on what does not seem to be a value (%zu).\n", value); +- } ++ if (value_data_structure_length == 0) { ++ fprintf (stderr, "value_byte_runs: hivex_value_struct_length: %m\n"); + return -1; + } +- hive_value_h value_data_cell_offset = hivex_value_data_cell_offset (h, value, &value_data_cell_length); +- if (errno != 0) ++ errno = 0; ++ hive_value_h value_data_cell_offset = ++ hivex_value_data_cell_offset (h, value, &value_data_cell_length); ++ if (value_data_cell_offset == 0 && errno != 0) { ++ fprintf (stderr, "value_byte_runs: hivex_value_data_cell_offset: %m\n"); + return -1; ++ } + + XML_CHECK (xmlTextWriterStartElement, (writer, BAD_CAST "byte_runs")); + memset (buf, 0, 1+BYTE_RUN_BUF_LEN); +-- +2.0.4 + diff --git a/SOURCES/ruby-vendor-not-site.patch b/SOURCES/ruby-vendor-not-site.patch deleted file mode 100644 index d36b6eb..0000000 --- a/SOURCES/ruby-vendor-not-site.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- hivex-1.3.8.old/ruby/Makefile.am 2013-07-25 15:09:00.000000000 +0100 -+++ hivex-1.3.8/ruby/Makefile.am 2013-07-25 23:17:05.888067146 +0100 -@@ -45,13 +45,13 @@ - $(RAKE) build - $(RAKE) rdoc - --RUBY_SITELIB := $(shell $(RUBY) -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']") --RUBY_SITEARCH := $(shell $(RUBY) -rrbconfig -e "puts RbConfig::CONFIG['sitearchdir']") -+RUBY_VENDORLIB := $(shell $(RUBY) -rrbconfig -e "puts RbConfig::CONFIG['vendorlibdir']") -+RUBY_VENDORARCH := $(shell $(RUBY) -rrbconfig -e "puts RbConfig::CONFIG['vendorarchdir']") - - install: -- $(MKDIR_P) $(DESTDIR)$(RUBY_SITELIB) -- $(MKDIR_P) $(DESTDIR)$(RUBY_SITEARCH) -- $(INSTALL) -p -m 0644 lib/hivex.rb $(DESTDIR)$(RUBY_SITELIB) -- $(INSTALL) -p -m 0755 ext/hivex/_hivex.so $(DESTDIR)$(RUBY_SITEARCH) -+ $(MKDIR_P) $(DESTDIR)$(RUBY_VENDORLIB) -+ $(MKDIR_P) $(DESTDIR)$(RUBY_VENDORARCH) -+ $(INSTALL) -p -m 0644 lib/hivex.rb $(DESTDIR)$(RUBY_VENDORLIB) -+ $(INSTALL) -p -m 0755 ext/hivex/_hivex.so $(DESTDIR)$(RUBY_VENDORARCH) - - endif diff --git a/SPECS/hivex.spec b/SPECS/hivex.spec index 7813019..81e7343 100644 --- a/SPECS/hivex.spec +++ b/SPECS/hivex.spec @@ -6,8 +6,8 @@ %endif Name: hivex -Version: 1.3.8 -Release: 4%{?dist} +Version: 1.3.10 +Release: 5.7%{?dist} Summary: Read and write Windows Registry binary hive files License: LGPLv2 @@ -17,11 +17,21 @@ Source0: http://libguestfs.org/download/hivex/%{name}-%{version}.tar.gz # Fix Perl directory install path. Patch0: %{name}-1.3.8-dirs.patch - -# Use VENDOR*DIR instead of SITE*DIR (not yet upstream). -Patch2: ruby-vendor-not-site.patch BuildRequires: autoconf, automake, libtool, gettext-devel +# Upstream patches to fix RHBZ#1145056 +Patch1: 0001-value-Set-errno-0-on-non-error-path-in-hivex_value_d.patch +Patch2: 0002-hivexml-Tidy-up-error-handling-and-printing.patch +Patch3: 0001-lib-Don-t-leak-errno-from-_hivex_recode-function.patch + +# Upstream patches to fix RHBZ#1158992 +Patch4: 0001-handle-Refuse-to-open-files-8192-bytes-in-size.patch +Patch5: 0002-handle-Check-that-pages-do-not-extend-beyond-the-end.patch + +# Fix typo in documentation (RHBZ#1099286). +# Patch contains upstream fix + generated code. +Patch6: 0001-generator-Fix-a-spelling-mistake-in-the-documentatio.patch + BuildRequires: perl BuildRequires: perl-Test-Simple BuildRequires: perl-Test-Pod @@ -138,7 +148,7 @@ python-%{name} contains Python bindings for %{name}. %package -n ruby-%{name} Summary: Ruby bindings for %{name} Requires: %{name} = %{version}-%{release} -Requires: ruby(release) = 2.0.0 +Requires: ruby(release) Requires: ruby Provides: ruby(hivex) = %{version} @@ -150,13 +160,18 @@ ruby-%{name} contains Ruby bindings for %{name}. %setup -q %patch0 -p1 -b .dirs -%patch2 -p1 -b .rubyvendor autoreconf -i +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build %configure --disable-static -make %{?_smp_mflags} +make V=1 INSTALLDIRS=vendor %{?_smp_mflags} %check @@ -172,7 +187,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs/*hivex* %install -make install DESTDIR=$RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT INSTALLDIRS=vendor # Remove unwanted libtool *.la file: rm $RPM_BUILD_ROOT%{_libdir}/libhivex.la @@ -254,6 +269,30 @@ rm $RPM_BUILD_ROOT%{python_sitearch}/libhivexmod.la %changelog +* Mon Nov 17 2014 Richard W.M. Jones - 1.3.10-5.7 +- Fix: "Argument list too long" when using virt-v2v on Windows guest + with French copy of Citrix installed + related: rhbz#1145056 + +* Mon Nov 17 2014 Richard W.M. Jones - 1.3.10-5.6 +- Fix: typo in man page + resolves: rhbz#1099286 + +* Thu Nov 13 2014 Richard W.M. Jones - 1.3.10-5.4 +- Fix: hivex missing checks for small/truncated files + resolves: rhbz#1158992 + +* Wed Sep 24 2014 Richard W.M. Jones - 1.3.10-5.3 +- Fix: hivexml generates "Argument list too long" error. + resolves: rhbz#1145056 + +* Fri Aug 08 2014 Richard W.M. Jones - 1.3.10-5.2 +- Resolves: rhbz#1125544 + +* Mon Jul 21 2014 Richard W.M. Jones - 1.3.10-5.1 +- Rebase to hivex 1.3.10. + resolves: rhbz#1023978 + * Fri Jan 24 2014 Daniel Mach - 1.3.8-4 - Mass rebuild 2014-01-24