Commit Graph

5260 Commits

Author SHA1 Message Date
Richard W.M. Jones
dcdc919c5f lua: Don't redefine lua_objlen if already defined.
lua 5.2.2 seems to define this symbol already.

(cherry picked from commit 5ee193433a)
2014-05-07 16:00:04 +01:00
Pino Toscano
83b054537a lib: xmlParse{File,Memory} -> xmlRead{File,Memory}
Switch from xmlParse* to xmlRead* so we can explicitly specify parsing
flags, including no network usage and no entity resolution.
The two behaviours mentioned above were not done before either, so this
should not introduce behaviour changes in libguestfs.

(cherry picked from commit 845daded5f)
2014-05-07 15:52:33 +01:00
Richard W.M. Jones
205d72417a Version 1.20.12. 1.20.12 2013-10-17 15:27:03 +01:00
Richard W.M. Jones
c1a0822b79 daemon: Fix xfs_info parser because of new format.
The old parser had several problems: firstly it called the error path
sometimes without calling reply_with_error causing a protocol hang.
More seriously it had hard-coded line numbers, and since Fedora 21 the
output of xfs_info has changed, moving lines around.

Change the parser to be more robust against added fields by using the
first name on the line as the section name, thus 'bsize=' is
interpreted differently depending on whether it appears in the "data"
section or the "naming" section.

Ensure also that we don't call the error path without calling
reply_with_error, which is a side-effect of the above change.

(cherry picked from commit 8abd0a83b3)
(cherry picked from commit adcdc44004)
2013-10-17 13:22:16 +01:00
Richard W.M. Jones
6a451ff65c fish: CVE-2013-4419: Fix insecure temporary directory handling for remote guestfish (RHBZ#1016960).
When using the guestfish --remote or guestfish --listen options,
guestfish would create a socket in a known location
(/tmp/.guestfish-$UID/socket-$PID).

The location has to be a known one in order for both ends to
communicate.  However no checking was done that the containing
directory (/tmp/.guestfish-$UID) is owned by the user.  Thus another
user could create this directory and potentially modify sockets owned
by another user's guestfish client or server.

This commit fixes the issue by creating the directory unconditionally,
and then checking that the directory has the correct owner and
permissions, thus preventing another user from creating the directory
first.

If guestfish sees a suspicious socket directory it will print an error
like this and exit with an error status:

  guestfish: '/tmp/.guestfish-1000' is not a directory or has insecure owner or permissions

Thanks: Michael Scherer for discovering this issue.

Version 2:
 - Add assigned CVE number.
 - Update documentation.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 54fb09e052)
(cherry picked from commit b23fca294e)
2013-10-17 13:21:23 +01:00
Richard W.M. Jones
baac27d95a fish: Use UNIX_PATH_MAX instead of hard-coded value for max length of socket buf.
(cherry picked from commit 9f1bcbca55)
(cherry picked from commit e42a6e5e54)
2013-10-17 13:21:17 +01:00
Richard W.M. Jones
0be5cd3357 Version 1.20.11. 1.20.11 2013-08-27 12:03:46 +01:00
Richard W.M. Jones
6d763b86d6 align/domains.c: Remove include of progname.h.
This was inadvertently broken by
commit d241876bd1.  This wasn't
noticed until I updated gnulib.
2013-08-27 11:56:57 +01:00
Richard W.M. Jones
2b43749535 daemon: sh: Fix missing initializer which caused segfault (RHBZ#1000121).
Thanks: Olaf Hering.
(cherry picked from commit fc2947b112)
(cherry picked from commit aea9761126)
2013-08-24 11:48:53 +01:00
Richard W.M. Jones
96ac6508d1 daemon: hivex: Define empty hivex_finalize function in case !HAVE_HIVEX.
Thanks: Olaf Hering (see previous commit).
(cherry picked from commit d188594b11)
(cherry picked from commit 379ced49de)
2013-08-24 11:48:48 +01:00
Olaf Hering
05507b9dbd tests: change noinst to check
This change avoids the hard requirement for qemu-tools during package
build.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
(cherry picked from commit cb7b1c56b7)
(cherry picked from commit 9b62b700ba)
2013-08-24 11:48:28 +01:00
Richard W.M. Jones
4872697c84 fish: Document that guestfish --remote --add won't work as expected (RHBZ#998513).
(cherry picked from commit 7e39695461)
(cherry picked from commit 23e9cc95fa)
2013-08-24 11:46:50 +01:00
Richard W.M. Jones
5c69b054d7 launch: direct: Don't try to wait for qemu if parent process forked (RHBZ#998482).
When using guestfish --remote, libguestfs is not the parent of qemu,
so waitpid is expected to return -ECHILD.  And indeed guestfish --remote
would print a bogus error message in this case:

  libguestfs: error: waitpid (qemu): No child processes

If the parent process forked into the background, then it should have
called 'set_recovery_proc 0' so we can use this to determine if we
need to wait for qemu.

Thanks: Kazuya Saito for reporting and identifying the issue.

(cherry picked from commit a843b5e5e3)
(cherry picked from commit 8b354dbbfd)
2013-08-24 11:46:41 +01:00
Or Goshen
d94a55df00 Fix to src/proto.c in libguestfs so it will compile with portablexdr under mingw.
(cherry picked from commit 18b40a8892)
(cherry picked from commit 5fe8a679ee)
2013-08-24 11:45:53 +01:00
Richard W.M. Jones
1820cdd87d FAQ: Replace the debugging section (again) with a checklist of information we need to start to fix bugs.
(cherry picked from commit abc59d776a)
(cherry picked from commit a9f7bd6934)
2013-08-24 11:45:19 +01:00
Richard W.M. Jones
2763d94884 FAQ: Move #debug anchor back to the right place.
This was accidentally moved by this commit:

  commit b8b5ed65c2
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Wed May 23 11:46:23 2012 +0100

    FAQ: Add section about using libguestfs in closed source programs.

(cherry picked from commit 0a484e868f)
(cherry picked from commit e02bbeabb1)
2013-08-24 11:45:02 +01:00
Richard W.M. Jones
0415edfec7 FAQ: Delete section about Ubuntu 10.04.
The link was broken, and we don't support Ubuntu 10.04 (maybe the
'oldlinux' branch does).

(cherry picked from commit 937a9a3532)
(cherry picked from commit 023dc6f23c)
2013-08-24 11:44:56 +01:00
Richard W.M. Jones
129198d46f cleanups: Use correct types for some cleanup functions.
(cherry picked from commit f68d5ee16c)
(cherry picked from commit 61f4a56c9d)
2013-08-24 11:43:57 +01:00
Richard W.M. Jones
92912c484e lib: Add stringsbuf mini-library for constructing lists of strings.
This is modelled on similar code in the daemon that we have used
successfully for a long time.

(cherry picked from commit 35278e4c18)
(cherry picked from commit 7fd3b1cc8a)
2013-08-24 11:41:51 +01:00
Richard W.M. Jones
d393c8555f list-filesystems: Don't fail if there are no filesystems found (RHBZ#995711).
list-filesystems was returning NULL (but not setting an error) if no
filesystems were found.  Instead return an empty list.

(cherry picked from commit f1d2934216)
(cherry picked from commit 1930966100)
2013-08-24 11:41:46 +01:00
Richard W.M. Jones
05f19651be cmd: Better type checking in CLEANUP_CMD_CLOSE macro.
(cherry picked from commit d0a2057786)
(cherry picked from commit db41261968)
2013-08-24 11:41:39 +01:00
Richard W.M. Jones
ab5f654bd2 utils: Move guestfs___drive_name function to the utilities library.
For some historical reason, it was stuck in src/launch-direct.c and
the comment referred to launch-appliance.c!

(cherry picked from commit 00cbb5c185)
(cherry picked from commit 750841e389)
2013-08-24 11:41:34 +01:00
Richard W.M. Jones
4df69b604d podwrapper: guestunmount is a libguestfs page, don't link it to he.net.
Cherry picked from commit bd30d3a61c
and commit 0087cf2531.

Note that libguestfs 1.20 does not use guestunmount.
2013-08-24 11:40:58 +01:00
Richard W.M. Jones
be94e86f89 Remove contrib file from EXTRA_DIST.
This fixes commit 36d29700dc.

(cherry picked from commit b1a8733511)
(cherry picked from commit fc42ba845e)
2013-08-24 11:40:32 +01:00
Richard W.M. Jones
1c4fe1567a Remove contrib/guestfsd-in-wine.sh.
Added in 2009, unlikely it still works since I doubt it has been
compiled since then.

(cherry picked from commit 36d29700dc)
(cherry picked from commit 18995c0857)
2013-08-24 11:40:28 +01:00
Richard W.M. Jones
9cb032f8e3 virt-list-filesystems: Fix to use $g->canonical_device_name instead of homebrew function.
The homebrew function didn't recognize /dev/ubd* device names, and in
any case using the API function is shorter and clearer.

(cherry picked from commit 4275404626)
(cherry picked from commit b312c245d3)
2013-08-24 11:40:21 +01:00
Richard W.M. Jones
f3630d2203 daemon: md: Whitespace fixes.
(cherry picked from commit 52188f1ea3)
(cherry picked from commit b36a3c3f06)
2013-08-24 11:39:37 +01:00
Richard W.M. Jones
8134c84da0 daemon: If /proc/modules doesn't exist, linuxmodules optgroup is disabled.
It likely means the kernel was compiled without modules support.

(cherry picked from commit 8ad634877c)
(cherry picked from commit 6503aa1681)
2013-08-24 11:39:28 +01:00
Richard W.M. Jones
0be9e1fc77 tests/md: Fix error path to display the correct output.
(cherry picked from commit 42abbf0969)
(cherry picked from commit c55592a894)
2013-08-24 11:39:16 +01:00
Richard W.M. Jones
d114e288c3 launch: direct: Print \n after printing qemu command line.
This makes it easier to see error messages printed by qemu.

(cherry picked from commit 19ee64303e)
(cherry picked from commit 847c515043)
2013-08-24 11:38:47 +01:00
Richard W.M. Jones
6ef05a8201 lib: Turn 'random_chars' function used by libvirt backend into utility function.
(cherry picked from commit e5285cc421)
(cherry picked from commit 0a22c69b7f)
2013-08-24 11:38:37 +01:00
Richard W.M. Jones
89f208648c utils: Remove duplicate inclusion of <string.h>.
(cherry picked from commit 467fd96e7e)
(cherry picked from commit de5faac35b)
2013-08-24 11:38:32 +01:00
Richard W.M. Jones
72c9bae8ad daemon: ldm: Don't return an error if /dev/mapper doesn't exist.
(cherry picked from commit 2089f7a21a)
(cherry picked from commit 1879ba2cb0)
2013-08-24 11:38:21 +01:00
Richard W.M. Jones
a51db42ed3 daemon: Remove unnecessary sysroot_path (selinux).
This fixes commit 72afcf450a.

(cherry picked from commit 7367729ec7)
(cherry picked from commit 576379a347)
2013-08-24 11:37:26 +01:00
Richard W.M. Jones
3f2a773178 appliance/init: Display uname -a in debug output.
Useful for debugging kernel / architecture issues.  Note this
has no effect if debugging is disabled.

(cherry picked from commit 6c2fad11ac)
(cherry picked from commit 9fc75d4133)
2013-08-24 11:36:22 +01:00
Richard W.M. Jones
3200903f38 daemon: Close augeas, hivex handles in unmount_all.
This is also called implicitly from internal_autosync, ensuring that
exit won't fail because of an open handle.

libguestfs: error: internal_autosync: umount: /sysroot: umount: /sysroot: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

Cherry picked from commit ce6e5738fc
and modified to remove references to the journal.

(cherry picked from commit 4d5da455cc)
2013-08-24 11:36:16 +01:00
Paul Mackerras
c9a2a812e2 Fix parsing of boot flag in do_part_get_bootable()
The code in do_part_get_bootable() assumes that if a partition has the
bootable flag set, then that is the only flag.  It compares the entire
flags field with the string "boot".  However, the boot flag isn't
always the only flag.  For instance, POWER systems typically have a
bootable partition of type 0x41 (PPC PReP boot), which parted -m
displays as:

# parted -m -- f18.img unit b print
BYT;
/root/f18.img:16106127360B:file:512:512:msdos::;
1:1048576B:5242879B:4194304B:::boot, prep;

That is, the flags field contains "boot, prep", and thus libguestfs
fails to see that this partition is bootable.  Ultimately this causes
virt-resize to fail to set the bootable flag on the boot partition of
the destination image, resulting in an image that won't boot.

This patch fixes the problem by searching for the string "boot" within
the flags field, instead of comparing the whole flags field.

(cherry picked from commit 7c535c501b)
(cherry picked from commit 6d80000dd6)
2013-08-24 11:36:04 +01:00
Richard W.M. Jones
3d83f92799 Update Transifex domain name from .net -> .com.
(cherry picked from commit 56f613b130)
(cherry picked from commit 7d1c54be14)
2013-08-24 11:35:58 +01:00
Richard W.M. Jones
e7ad6ebaf6 Update TODO file.
(cherry picked from commit f6b2efcdff)
(cherry picked from commit fd32ca199d)
2013-08-24 11:34:50 +01:00
Richard W.M. Jones
040b0260f0 augeas: Improve error reporting.
Display all the information from the handle about errors.

(cherry picked from commit f26a0407d2)
(cherry picked from commit fde27df3c9)
2013-08-24 11:34:08 +01:00
Richard W.M. Jones
92e2bfbe0c launch: direct: Add drives after machine parameters.
This is just code motion.  It should affect the semantics of the code,
nor how the appliance VM is created.

(cherry picked from commit 568368cdf5)
(cherry picked from commit 0fdc3f478d)
2013-08-24 11:34:04 +01:00
Richard W.M. Jones
033d9898ab ./run: Omit timeout -k option on RHEL 6.
If timeout doesn't have the -k option, don't use it.

(cherry picked from commit 8d68f1c5ce)
(cherry picked from commit 2809754504)
2013-08-24 11:33:54 +01:00
Richard W.M. Jones
d726f7209f resize: Mark progress bar functions as "noalloc".
Avoids GC overhead and turns these into simple C calls.  See:
http://camltastic.blogspot.co.uk/2008/08/tip-calling-c-functions-directly-with.html

(cherry picked from commit 67fd809ca3)
(cherry picked from commit 28049a4df7)
2013-08-24 11:33:40 +01:00
Richard W.M. Jones
2f4945ae1a resize: Mark isatty function as "noalloc".
This turns it into an ordinary C call without the unnecessary [in this
case] GC frame overhead.  See:
http://camltastic.blogspot.co.uk/2008/08/tip-calling-c-functions-directly-with.html

(cherry picked from commit 3d39549ded)
(cherry picked from commit a08b4304d1)
2013-08-24 11:33:37 +01:00
Richard W.M. Jones
5df8d6949c FAQ: Tips about using direct backend and fixed appliance on Fedora/RHEL.
(cherry picked from commit 0c512a52bd)
(cherry picked from commit 790852397e)
2013-08-24 11:33:32 +01:00
Richard W.M. Jones
5cf5e8c5f2 FAQ: Common problem with Debian is not running update-guestfs-appliance.
(cherry picked from commit 9268f14879)
(cherry picked from commit 5bd7e6cca1)
2013-08-24 11:33:27 +01:00
Richard W.M. Jones
566927a20a internal: Add CLEANUP_XMLFREEURI (cleanup function for xmlURIPtr).
(cherry picked from commit 0e1ba00059)
(cherry picked from commit acba583d18)
2013-08-24 11:32:01 +01:00
Richard W.M. Jones
5c688c333e resize: Move isatty_stdout function to separate module (TTY.isatty_stdout).
It was jammed into the Progress module just for convenience.

(cherry picked from commit b56990ddf8)
(cherry picked from commit 93daf42b52)
2013-08-24 11:31:16 +01:00
Richard W.M. Jones
b41a7d88f2 daemon: cap-get-file: Return empty string if no capability on file (RHBZ#989356).
Return an empty string (instead of an error) if no capabilities are
set on a file, and document that in the API.

(cherry picked from commit c663ab3bb9)
(cherry picked from commit 01df523fff)
2013-08-24 11:30:45 +01:00
Richard W.M. Jones
5991b15bc5 resize: Link to information about dracut-modules-growroot.
(cherry picked from commit fb282e677c)
(cherry picked from commit 64b67377b6)
2013-08-24 11:30:42 +01:00