]> xenbits.xensource.com Git - libvirt.git/commit
nwfilter: avoid failure with noexec /tmp
authorEric Blake <eblake@redhat.com>
Wed, 9 Nov 2011 17:23:49 +0000 (10:23 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 10 Nov 2011 00:02:48 +0000 (17:02 -0700)
commitbd6083c9baf1a8248b3b9fcde0a2c3f44e8e61ad
treed7c0a01916571af1504e9407fa743213b1aa5248
parent0eee075dc7e3336a7dc9509ec7fb0bd6284e8ef2
nwfilter: avoid failure with noexec /tmp

If /tmp is mounted with the noexec flag (common on security-conscious
systems), then nwfilter will fail to initialize, because we cannot
run any temporary script via virRun("/tmp/script"); but we _can_
use "/bin/sh /tmp/script".  For that matter, using /tmp risks collisions
with other unrelated programs; we already have /var/run/libvirt as a
dedicated temporary directory for use by libvirt.

* src/nwfilter/nwfilter_ebiptables_driver.c
(ebiptablesWriteToTempFile): Use internal directory, not /tmp;
drop attempts to make script executable; and detect close error.
(ebiptablesExecCLI): Switch to virCommand, and invoke the shell to
read the script, rather than requiring an executable script.
src/nwfilter/nwfilter_ebiptables_driver.c