mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: simplify virCommand APIs for env passthrough.
Now that 100% of libvirt code is forbidden in a SUID environment, we no longer need to worry about whether env variables are trustworthy or not. The virt-login-shell setuid program, which does not link to any libvirt code, will purge all environment variables, except $TERM, before invoking the virt-login-shell-helper program which uses libvirt. Thus we only need one API for env passthrough in virCommand. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -305,8 +305,8 @@ static int test6(const void *unused ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virCommandPtr cmd = virCommandNew(abs_builddir "/commandhelper");
|
||||
|
||||
virCommandAddEnvPassBlockSUID(cmd, "DISPLAY", NULL);
|
||||
virCommandAddEnvPassBlockSUID(cmd, "DOESNOTEXIST", NULL);
|
||||
virCommandAddEnvPass(cmd, "DISPLAY");
|
||||
virCommandAddEnvPass(cmd, "DOESNOTEXIST");
|
||||
|
||||
if (virCommandRun(cmd, NULL) < 0) {
|
||||
printf("Cannot run child %s\n", virGetLastErrorMessage());
|
||||
@@ -329,8 +329,8 @@ static int test7(const void *unused ATTRIBUTE_UNUSED)
|
||||
virCommandPtr cmd = virCommandNew(abs_builddir "/commandhelper");
|
||||
|
||||
virCommandAddEnvPassCommon(cmd);
|
||||
virCommandAddEnvPassBlockSUID(cmd, "DISPLAY", NULL);
|
||||
virCommandAddEnvPassBlockSUID(cmd, "DOESNOTEXIST", NULL);
|
||||
virCommandAddEnvPass(cmd, "DISPLAY");
|
||||
virCommandAddEnvPass(cmd, "DOESNOTEXIST");
|
||||
|
||||
if (virCommandRun(cmd, NULL) < 0) {
|
||||
printf("Cannot run child %s\n", virGetLastErrorMessage());
|
||||
|
||||
Reference in New Issue
Block a user