[Libguestfs] [PATCH] Add simple parsing logic for hostname file.

2022-07-20 Thread Dawid Zamirski
There are some linux systems in the wild where the /etc/hostname file does not contain the configured hostname as sole line in that file. This file actually allows for comments [1] starting with "#" and the original logic would extract the comment line instead of the hostname on such systems. This

Re: [Libguestfs] [PATCH] parted: add more udev_settle calls.

2017-03-02 Thread Dawid Zamirski
On Thu, 2017-03-02 at 17:44 -0500, Dawid Zamirski wrote: > add udev_settle calls to print_partition_table and > sgdisk_info_extract_field because the inspect-os calls > guestfs_part_get_parttype and guestfs_part_get_gpt_guid for all > parition devices found and this causes

[Libguestfs] [PATCH] parted: add more udev_settle calls.

2017-03-02 Thread Dawid Zamirski
add udev_settle calls to print_partition_table and sgdisk_info_extract_field because the inspect-os calls guestfs_part_get_parttype and guestfs_part_get_gpt_guid for all parition devices found and this causes intermittent with opening block devices that are certainly present yet RESOLVE_DEVICE

[Libguestfs] [PATCH v4 3/5] lib: allow to walk registry with corrupted blocks

2017-02-16 Thread Dawid Zamirski
Only when HIVEX_OPEN_UNSAFE flag is set. There are some corrupted registry files that have invalid hbin cells but are still readable. This patch makes the following changes: * hivex_open - do not abort with complete failure if we run across a block with invalid size (unless it's the root

[Libguestfs] [PATCH v4 0/5] hivex: handle corrupted hives better.

2017-02-16 Thread Dawid Zamirski
ng when errors happen that we can recover from - as separate patches 4 & 5 Regards, Dawid Zamirski (5): add HIVEX_OPEN_UNSAFE flag. lib: change how hbin sections are read. lib: allow to walk registry with corrupted blocks hivexsh: add -u flag for HIVEX_OPEN_UNSAFE. hivexregedit: all

[Libguestfs] [PATCH v4 1/5] add HIVEX_OPEN_UNSAFE flag.

2017-02-16 Thread Dawid Zamirski
This flag will be used to control behavior of libhivex API functions so that they tolerate corruption in hives by either using heuristic recovery from unexpected situations or simply ignore bad registry keys/values whenever possible. --- generator/generator.ml | 8 lib/handle.c

[Libguestfs] [PATCH v4 5/5] hivexregedit: allow to pass HIVEX_OPEN_UNSAFE

2017-02-16 Thread Dawid Zamirski
via new --unsafe flag. Also make --export catpure, log and skip over errors when reading subkeys/values so that export in unsafe mode does not abort at first sign of error. --- perl/lib/Win/Hivex/Regedit.pm | 59 ++- regedit/hivexregedit | 20

[Libguestfs] [PATCH v4 4/5] hivexsh: add -u flag for HIVEX_OPEN_UNSAFE.

2017-02-16 Thread Dawid Zamirski
and pass it to hivex_open. Additionally make hivex_value_value failures non-critical in this mode when iterating through node children/values. --- sh/hivexsh.c | 26 -- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/sh/hivexsh.c b/sh/hivexsh.c index

[Libguestfs] [PATCH v4 2/5] lib: change how hbin sections are read.

2017-02-16 Thread Dawid Zamirski
Only when HIVEX_OPEN_UNSAFE flag is set: * hivex_open: when looping over hbin sections (aka pages), handle a case where following hbin section may not begin at exactly at the end of previous one. If this happens, scan the page section until next one is found and validate it by checking

Re: [Libguestfs] [PATCH v2 1/2] lib: change how hbin sections are read.

2017-02-16 Thread Dawid Zamirski
On Thu, 2017-02-16 at 08:43 +, Richard W.M. Jones wrote: > On Wed, Feb 15, 2017 at 10:59:33PM +, Richard W.M. Jones wrote: > > > > OK, I ended up turning the warning off.  It appears from the > > info file that the warning is about GCC not being able to make > > an optimization, not a bug

Re: [Libguestfs] [PATCH v2 1/2] lib: change how hbin sections are read.

2017-02-15 Thread Dawid Zamirski
On Wed, 2017-02-15 at 22:35 +, Richard W.M. Jones wrote: > On Wed, Feb 15, 2017 at 10:29:41PM +, Richard W.M. Jones wrote: > > Yes, or even how about this (not tried it): > > > > while (off <= h->endpages - 0x1000) { > >   ... > > } > > In fact this doesn't work either :-( > > I'll have

Re: [Libguestfs] [PATCH v2 1/2] lib: change how hbin sections are read.

2017-02-15 Thread Dawid Zamirski
On Wed, 2017-02-15 at 16:50 -0500, Dawid Zamirski wrote: > On Wed, 2017-02-15 at 21:14 +, Richard W.M. Jones wrote: > > On Wed, Feb 15, 2017 at 02:28:41PM -0500, Dawid Zamirski wrote: > > > Correct, however there's also no guarantee that seeking by 4k in > > > "

Re: [Libguestfs] [PATCH v2 1/2] lib: change how hbin sections are read.

2017-02-15 Thread Dawid Zamirski
On Wed, 2017-02-15 at 21:14 +, Richard W.M. Jones wrote: > On Wed, Feb 15, 2017 at 02:28:41PM -0500, Dawid Zamirski wrote: > > Correct, however there's also no guarantee that seeking by 4k in > > "garbage" data would not land you in registry data that happens to >

[Libguestfs] [PATCH v3 2/2] lib: allow to walk registry with corrupted blocks

2017-02-15 Thread Dawid Zamirski
There are some corrupted registry files that have invalid hbin cells but are still readable. This patch makes the following changes: * hivex_open - do not abort with complete failure if we run across a block with invalid size (unless it's the root block). Instead just log the event, and move

Re: [Libguestfs] [PATCH v2 1/2] lib: change how hbin sections are read.

2017-02-15 Thread Dawid Zamirski
On Wed, 2017-02-15 at 18:52 +, Richard W.M. Jones wrote: > On Wed, Feb 15, 2017 at 01:48:29PM -0500, Dawid Zamirski wrote: > > On Wed, 2017-02-15 at 16:54 +, Richard W.M. Jones wrote: > > > On Tue, Feb 14, 2017 at 12:05:20PM -0500, Dawid Zamirski wrote: > > > &

Re: [Libguestfs] [PATCH v2 1/2] lib: change how hbin sections are read.

2017-02-15 Thread Dawid Zamirski
On Wed, 2017-02-15 at 16:54 +, Richard W.M. Jones wrote: > On Tue, Feb 14, 2017 at 12:05:20PM -0500, Dawid Zamirski wrote: > > * hivex_open: when looping over hbin sections (aka pages), handle a > >   case where following hbin section may not begin at exactly at the > >

[Libguestfs] [PATCH v3 0/2] hivex: handle corrupted hives better

2017-02-15 Thread Dawid Zamirski
ch does not have to be true and GCC7 is correct. Regards, Dawid Zamirski (2): lib: change how hbin sections are read. lib: allow to walk registry with corrupted blocks lib/handle.c | 55 ++- lib/node.c | 21

[Libguestfs] [PATCH v3 1/2] lib: change how hbin sections are read.

2017-02-15 Thread Dawid Zamirski
* hivex_open: when looping over hbin sections (aka pages), handle a case where following hbin section may not begin at exactly at the end of previous one. If this happens, scan the page section until next one is found and validate it by checking declared offset with actual one - if they

[Libguestfs] [PATCH v2 2/2] lib: allow to walk registry with corrupted blocks

2017-02-14 Thread Dawid Zamirski
There are some corrupted registry files that have invalid hbin cells but are still readable. This patch makes the following changes: * hivex_open - do not abort with complete failure if we run across a block with invalid size (unless it's the root block). Instead just log the event, and move

[Libguestfs] [PATCH v2 0/2] hivex: handle corrupted hives better

2017-02-14 Thread Dawid Zamirski
lty block with debug message Regards, Dawid Zamirski (2): lib: change how hbin sections are read. lib: allow to walk registry with corrupted blocks lib/handle.c | 55 ++- lib/node.c | 21 - 2 files changed, 58 inserti

[Libguestfs] [PATCH v2 1/2] lib: change how hbin sections are read.

2017-02-14 Thread Dawid Zamirski
* hivex_open: when looping over hbin sections (aka pages), handle a case where following hbin section may not begin at exactly at the end of previous one. If this happens, scan the page section until next one is found and validate it by checking declared offset with actual one - if they

Re: [Libguestfs] [PATCH 2/2] lib: allow to walk registry with corrupted blocks

2017-02-14 Thread Dawid Zamirski
On Tue, 2017-02-14 at 14:30 +, Richard W.M. Jones wrote: > On Wed, Feb 08, 2017 at 04:36:31PM -0500, Dawid Zamirski wrote: > > There are some corrupted registry files that have invalid hbin > > cells > > but are still readable. This patch makes the following changes: >

Re: [Libguestfs] [PATCH 2/2] lib: allow to walk registry with corrupted blocks

2017-02-14 Thread Dawid Zamirski
Hi Rich, Thanks for taking time to review my patches. On Tue, 2017-02-14 at 14:30 +, Richard W.M. Jones wrote: > On Wed, Feb 08, 2017 at 04:36:31PM -0500, Dawid Zamirski wrote: > > = > > +if (is_root) { > > +  bad_root_block = 1; > > +} el

[Libguestfs] [PATCH v3] inspect: get windows drive letters for GPT disks.

2016-02-06 Thread Dawid Zamirski
This patch updates the guestfs_inspect_get_drive_mappings API call to also return drive letters for GPT paritions. Previously this worked only for MBR partitions. This is achieved by matching the GPT partition GUID with the info stored in the blob from HKLM\SYSTEM\MountedDevices\DosDevices keys.

[Libguestfs] [PATCHv2] inspect: get windows drive letters for GPT disks.

2016-02-05 Thread Dawid Zamirski
This patch updates the guestfs_inspect_get_drive_mappings API call to also return drive letters for GPT paritions. Previously this worked only for MBR partitions. This is achieved by matching the GPT partition GUID with the info stored in the blob from HKLM\SYSTEM\MountedDevices\DosDevices keys.

[Libguestfs] [PATCH] inspect: get windows drive letters for GPT disks.

2016-02-05 Thread Dawid Zamirski
This patch updates the guestfs_inspect_get_drive_mappings API call to also return drive letters for GPT paritions. Previously this worked only for MBR partitions. This is achieved by matching the GPT partition GUID with the info stored in the blob from HKLM\SYSTEM\MountedDevices\DosDevices keys.

Re: [Libguestfs] [PATCH] inspect: get windows drive letters for GPT disks.

2016-02-05 Thread Dawid Zamirski
On Fri, 2016-02-05 at 18:08 +, Richard W.M. Jones wrote: > On Fri, Feb 05, 2016 at 12:15:32PM -0500, Dawid Zamirski wrote: > > This patch updates the guestfs_inspect_get_drive_mappings API call > > to > > also return drive letters for GPT paritions. Previously this wo