Make vmd respect owner when starting non-disabled vms.
authorabieber <abieber@openbsd.org>
Wed, 6 Dec 2017 13:29:02 +0000 (13:29 +0000)
committerabieber <abieber@openbsd.org>
Wed, 6 Dec 2017 13:29:02 +0000 (13:29 +0000)
OK pd@, benno@

usr.sbin/vmd/vmd.c

index 894709c..469a285 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vmd.c,v 1.75 2017/11/30 01:28:27 ccardenas Exp $      */
+/*     $OpenBSD: vmd.c,v 1.76 2017/12/06 13:29:02 abieber Exp $        */
 
 /*
  * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -102,7 +102,7 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg)
                        cmd = IMSG_VMDOP_START_VM_RESPONSE;
                }
                if (res == 0 &&
-                   config_setvm(ps, vm, imsg->hdr.peerid, vmc.vmc_uid) == -1) {
+                   config_setvm(ps, vm, imsg->hdr.peerid, vm->vm_params.vmc_uid) == -1) {
                        res = errno;
                        cmd = IMSG_VMDOP_START_VM_RESPONSE;
                }
@@ -840,7 +840,7 @@ vmd_configure(void)
                            vm->vm_params.vmc_params.vcp_name);
                        continue;
                }
-               if (config_setvm(&env->vmd_ps, vm, -1, 0) == -1)
+               if (config_setvm(&env->vmd_ps, vm, -1, vm->vm_params.vmc_uid) == -1)
                        return (-1);
        }
 
@@ -918,7 +918,7 @@ vmd_reload(unsigned int reset, const char *filename)
                                            vm->vm_params.vmc_params.vcp_name);
                                        continue;
                                }
-                               if (config_setvm(&env->vmd_ps, vm, -1, 0) == -1)
+                               if (config_setvm(&env->vmd_ps, vm, -1, vm->vm_params.vmc_uid) == -1)
                                        return (-1);
                        } else {
                                log_debug("%s: not creating vm \"%s\": "