summaryrefslogtreecommitdiffstats
path: root/src/inspect.c
Commit message (Collapse)AuthorAgeFilesLines
* Update inspection and example programs to use new hivex* APIs (RHBZ#852394).Richard W.M. Jones2012-08-291-143/+0
| | | | | | | | | | | | | | | | | | | | | | | I tested this by comparing the output of virt-inspector over Windows guests before and after the change, which was identical: $ md5sum `ls -1 /tmp/*.before /tmp/*.after` c292d6629b5a761eccb4a279754399b4 /tmp/Win2003.after c292d6629b5a761eccb4a279754399b4 /tmp/Win2003.before eb1e1ff29208a9ee46e9c100dfec26b2 /tmp/Win2012.after eb1e1ff29208a9ee46e9c100dfec26b2 /tmp/Win2012.before d060a95d7ffe5dce6c4e66feb80c2837 /tmp/Win7x32.after d060a95d7ffe5dce6c4e66feb80c2837 /tmp/Win7x32.before 8914eee70ac4f8a0317659e09e00dcdc /tmp/Win7x32Dynamic.after 8914eee70ac4f8a0317659e09e00dcdc /tmp/Win7x32Dynamic.before a2dcdfc0f9d64054640875aa791889e0 /tmp/Win7x32TwoDisks.after a2dcdfc0f9d64054640875aa791889e0 /tmp/Win7x32TwoDisks.before 5ed49568a5147dce7517c99de41ebf2e /tmp/Win8previewx64.after 5ed49568a5147dce7517c99de41ebf2e /tmp/Win8previewx64.before fdfc7d272b79a665ae3313ae1ae30660 /tmp/WinXP.after fdfc7d272b79a665ae3313ae1ae30660 /tmp/WinXP.before 3c705444be664f1316b21c5d8d3cb0be /tmp/WinXPRecConsole.after 3c705444be664f1316b21c5d8d3cb0be /tmp/WinXPRecConsole.before
* inspect: Clarify comment about uniqueness of cache.Richard W.M. Jones2012-08-151-1/+3
|
* Mac OS X: Added check of #include <endian.h>Masami HIRATA2012-07-241-0/+3
| | | | | | Mac OS X doesn't have endian.h Signed-off-by: Masami HIRATA <msmhrt@gmail.com>
* inspection: Set last errno to ENOTSUP when inspection APIs are not available.Richard W.M. Jones2012-03-201-1/+1
| | | | | | | | | | | | | | | Previously there was no programmatic way to tell if inspection APIs were unavailable because they are not compiled in (because hivex isn't around). This contrasts with daemon APIs where the availability is covered by the guestfs_available API. Change the inspection APIs so that when they are not available, the last errno is set to ENOTSUP. (Note that ENOTSUP must be defined on all POSIX platforms). This allows programs to detect if they are using a version of libguestfs that was compiled without support for inspection, without having to parse error messages.
* Use O_CLOEXEC / SOCK_CLOEXEC for almost all file descriptors.Richard W.M. Jones2012-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The presumption is that all file descriptors should be created with the close-on-exec flag set. The only exception are file descriptors that we want passed through to exec'd subprocesses (mainly pipes and stdin/stdout/stderr). For open calls, we pass O_CLOEXEC as an extra flag, eg: fd = open ("foo", O_RDONLY|O_CLOEXEC); This is a Linux-ism, but using a macro we can easily make it portable. For sockets, similarly: sock = socket (..., SOCK_STREAM|SOCK_CLOEXEC, ...); For accepted sockets, we use the Linux accept4 system call which allows flags to be supplied, but we use the Gnulib 'accept4' module to make this portable. For dup, dup2, we use the Linux dup3 system call, and the Gnulib modules 'dup3' and 'cloexec'.
* inspect: Use uint64_t for maximum file size in bytes.Richard W.M. Jones2012-03-121-2/+2
|
* Check return values from calloc (found by Coverity).Richard W.M. Jones2012-03-081-25/+29
| | | | | | | | | | | Error: NULL_RETURNS: /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:417: returned_null: Function "calloc" returns null (checked 67 out of 81 times). /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:417: var_assigned: Assigning: "ret" = null return value from "calloc". /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:418: dereference: Dereferencing a null pointer "ret". [...] /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:374: returned_null: Function "calloc" returns null (checked 67 out of 81 times). /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:374: var_assigned: Assigning: "ret" = null return value from "calloc". /builddir/build/BUILD/libguestfs-1.16.5/src/inspect.c:375: dereference: Dereferencing a null pointer "ret".
* inspection: Add detection of FreeDOS (RHBZ#786215).Richard W.M. Jones2012-03-071-0/+2
| | | | | FreeDOS is returned as type="dos", distro="freedos". No version or application information is returned at present.
* Add support for Buildroot and Cirros distributions.Richard W.M. Jones2012-03-071-0/+2
|
* Tempus fugit.Richard W.M. Jones2012-01-181-1/+1
| | | | Update all copyright dates to 2012.
* inspection: Add outline support for GNU/Hurd.Richard W.M. Jones2011-11-281-0/+1
|
* md: Inspect MD devicesMatthew Booth2011-11-241-0/+16
|
* NFC: Declare and use variables on the same line in inspect.cMatthew Booth2011-11-241-4/+2
|
* 32 bit: Use %td for ptrdiff_t (difference between two pointers).Richard W.M. Jones2011-11-111-1/+1
|
* Allow compilation without hivex (RHBZ#723474).Richard W.M. Jones2011-10-211-92/+92
|
* inspection: Return root devices sorted.Richard W.M. Jones2011-10-191-0/+11
|
* Add basic support for netbsd detection.Michael Scherer2011-10-141-1/+2
|
* Add support for pkgsrc, default NetBSD package manager.Michael Scherer2011-10-141-0/+1
| | | | | | For now, only detect the tool, but support from reading installed package could be added later ( may require either a package of pkgsrc, or a smaller tool to read the db ).
* Add Opensuse and zypper detection supportMichael Scherer2011-10-141-0/+2
| | | | This would also erronously detect SLES as Opensuse.
* Detect Mageia distributionMichael Scherer2011-10-141-0/+1
|
* inspection: Add support for ttylinux (a minimal Linux).Richard W.M. Jones2011-09-161-0/+1
|
* Require PCRE library.Richard W.M. Jones2011-07-251-6/+4
| | | | This library is widely available in distros.
* Change download_to_tmp so it can work with multi-root operating systems.Richard W.M. Jones2011-06-281-34/+39
| | | | | | | | | | | | | | | | The previous guestfs___download_to_tmp function did not handle multiboot correctly. In particular it used the same cache name for downloaded files from different roots, which could have caused things like applications in each root to be confused. This changes the function so that the cache filename is prefixed with the root / fs number, eg. $tmpdir/0-Name instead of $tmpdir/Name. This change also requires the function to return the new name, so all places in the code which called this function had to be updated. This updates and fixes commit 3c1f762abed92f7a358f3bc93e3396d0606b18ad.
* inspect: "centos" and "scientificlinux" are now separate distros.Richard W.M. Jones2011-04-211-0/+2
| | | | Previously we returned "rhel" for these, which was not accurate.
* inspect: Split code into separate files.Richard W.M. Jones2011-04-141-2533/+37
| | | | | | | | | | | | | | | | | The src/inspect.c file had grown rather large -- 3,500 lines. Split it across several files according to function. This is just moving code. After the split the files are more evenly divided: 536 src/inspect_apps.c 766 src/inspect.c 537 src/inspect_fs.c 404 src/inspect_fs_cd.c 785 src/inspect_fs_unix.c 535 src/inspect_fs_windows.c 3563 total
* inspect: Move shared PCRE match functions to separate file.Richard W.M. Jones2011-04-131-98/+0
| | | | This is just moving code around.
* inspect: Cache downloaded files in the handle g->tmpdir.Richard W.M. Jones2011-04-131-56/+72
| | | | | | | | | | | | | | | | | | During inspection we download various files such as the Windows 'software' and 'system' registries. Previously these were downloaded as temporary files and discarded immediately after use. This meant that the 'software' registry was being downloaded twice by virt-inspector (it's required once for basic OS inspection, and a second time to list Windows applications). This commit changes this so that these files are cached in g->tmpdir, and thus the second time we just reuse the file we've already downloaded. Callers shouldn't be relying on inspect-list-applications to reread the actual registry from the VM (unless you close and reopen the handle). It says in the documentation that the results of inspection may be cached in the handle.
* inspect: Fix some small memory leaks in Windows inspection.Richard W.M. Jones2011-04-121-0/+3
| | | | Found using valgrind.
* New API: inspect-get-drive-mappingsRichard W.M. Jones2011-04-051-1/+179
| | | | | | | | | | | | This returns the drive mappings from the Windows Registry. virt-inspector displays the drive mappings, giving output similar to this: <drive_mappings> <drive_mapping name="C">/dev/sda2</drive_mapping> <drive_mapping name="E">/dev/sdb1</drive_mapping> </drive_mappings>
* New API: inspect-get-windows-current-control-setRichard W.M. Jones2011-04-051-9/+65
| | | | | | | | | | | | | | This returns the actual registry key corresponding to CurrentControlSet (eg. it might be "ControlSet001"). Previously the inspection code was hard-coding ControlSet001. Now we use the correct control set, and also make it available to callers through the API. This commit also updates the virt-dhcp-address example so it uses this new API. virt-inspector displays the current control set when available.
* Rename resolve_windows_path_silently to case_sensitive_path_silently.Richard W.M. Jones2011-04-051-9/+9
| | | | | | A more accurate description of what this function does. This is just code motion.
* inspect: Detect 32 bit applications running on WOW64 emulator (RHBZ#692545).Richard W.M. Jones2011-03-311-42/+56
| | | | | | | These applications are located along a different Registry path. See http://support.microsoft.com/kb/896459 for all the details. Thanks Jinxin Zheng for finding the bug and the solution.
* inspector: Add detection of Slackware.Richard W.M. Jones2011-03-251-0/+12
| | | | Notes: Labels: feature
* New API: guestfs_inspect_get_product_variantRichard W.M. Jones2011-03-231-0/+25
| | | | | | | | | | This returns a product variant for inspected operating systems. In practice this is a useful way to distinguish between consumer and enterprise/server versions of Windows that otherwise have the same version number. Notes: Labels: feature
* inspect: Don't fail for Windows guests with multiple disks (RHBZ#674130).Richard W.M. Jones2011-03-221-2/+13
| | | | | Notes: Labels: bugfix, RHBZ#674130 Depends: 5776c145d411e5ae00072ecf422055f3d0bd29e2
* inspect: Simplify Windows root heuristic code.Richard W.M. Jones2011-03-221-12/+38
| | | | | | | | | Add special is_file_nocase and is_dir_nocase functions and remove the duplicate checks for files and directories with different cases. Notes: Labels: codemotion
* New event API (RHBZ#664558).Richard W.M. Jones2011-03-151-14/+10
| | | | | | | | | | | | | This API allows more than one callback to be registered for each event, makes it possible to call the API from other languages, and allows [nearly all] log, debug and trace messages to be rerouted from stderr. An older version of this API was discussed on the mailing list here: https://www.redhat.com/archives/libguestfs/2010-December/msg00081.html https://www.redhat.com/archives/libguestfs/2011-January/msg00012.html This also updates guestfish to use the new API for its progress bars.
* Detect Red Hat Desktop as 'rhel' distro (RHBZ#682979).Richard W.M. Jones2011-03-081-3/+3
| | | | | | | | | | | | | /etc/redhat-release on Red Hat Desktop contains the following string: Red Hat Desktop release 4 (Nahant Update 8) Previously we matched against the string "Red Hat Enterprise Linux" but since this does not contain that string, this distro wasn't being detected correctly. Note this also changes the obsolete Perl code, for the benefit of virt-v2v.
* Fix inspection code when PCRE or hivex is missing.Richard W.M. Jones2011-03-031-0/+24
|
* Add ability to inspect install disks and live CDs.Richard W.M. Jones2011-01-151-35/+527
| | | | | For examples of the virt-inspector output, see the additional inspector/example-*.xml files in this commit.
* inspect: Add macros for file size limits.Richard W.M. Jones2011-01-151-9/+37
| | | | | | This also bumps the file size limit for "small text files" up to 2 MB, since we want to parse Windows CD txtsetup.sif files that are usually around 500K in size.
* Remove several unused local variables.Richard W.M. Jones2010-12-101-4/+0
| | | | (Revealed by compiling under Debian where this is a warning).
* inspect: Detect if db_dump and db_load programs are available.Richard W.M. Jones2010-11-241-1/+7
| | | | | | If db_dump is not available then disable RPM application detection. Note these utilities have odd names on Debian.
* inspect: Fix memory leak of hostname.Richard W.M. Jones2010-11-191-0/+1
| | | | | This fixes a memory leak introduced by commit fab75c0337d7897d10ea5e95e47ac05eab81ace9.
* New API: inspect-get-hostname to return the hostname of the guest.Richard W.M. Jones2010-11-161-3/+238
| | | | | This returns the hostname of the guest. Tested on RHEL, Fedora, Debian 5, Ubuntu 10.10, FreeBSD 8, Windows 7.
* inspect: Check /etc/lsb-release is not too large before calling head on it.Richard W.M. Jones2010-11-161-1/+16
|
* inspect: Add function to read the first line of a file, with safety checks.Richard W.M. Jones2010-11-161-14/+42
|
* inspect: Abstract the wrapper that sets up Augeas.Richard W.M. Jones2010-11-161-33/+50
| | | | This is just code motion.
* New API: inspect-list-applications.Richard W.M. Jones2010-11-151-0/+452
| | | | | | | | This converts the current Perl code in virt-inspector for listing applications, into C, making it a part of the core API. This is also capable of fetching the list of Windows applications from the registry.
* inspect: Centralize all file downloads through a single function.Richard W.M. Jones2010-11-151-32/+52
|