diff options
author | Avi Kivity <avi@redhat.com> | 2010-06-21 16:55:09 +0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-06-21 16:55:09 +0300 |
commit | e4086bb7096cb506bebdf1f4e5f63faef4f6b02a (patch) | |
tree | 3b3c42b288203f8c56df96ec2f919e7a53613276 /vl.c | |
parent | Merge commit '59a5264b994343f01d19faf95c0e5df70346ded8' into upstream-merge (diff) | |
parent | Move runas handling from vl.c to OS specific files. (diff) | |
download | qemu-kvm-e4086bb7096cb506bebdf1f4e5f63faef4f6b02a.tar.gz qemu-kvm-e4086bb7096cb506bebdf1f4e5f63faef4f6b02a.tar.bz2 qemu-kvm-e4086bb7096cb506bebdf1f4e5f63faef4f6b02a.zip |
Merge commit '8847cfe8aa9d8f6b8648aafd5d929a57d836cc61' into upstream-merge
* commit '8847cfe8aa9d8f6b8648aafd5d929a57d836cc61':
Move runas handling from vl.c to OS specific files.
Conflicts:
vl.c
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 29 |
1 files changed, 1 insertions, 28 deletions
@@ -34,7 +34,6 @@ #ifndef _WIN32 #include <libgen.h> -#include <pwd.h> #include <sys/times.h> #include <sys/wait.h> #include <termios.h> @@ -2348,9 +2347,7 @@ int main(int argc, char **argv, char **envp) const char *incoming = NULL; #ifndef _WIN32 int fd = 0; - struct passwd *pwd = NULL; const char *chroot_dir = NULL; - const char *run_as = NULL; #endif int show_vnc_port = 0; int defconfig = 1; @@ -3138,9 +3135,6 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_chroot: chroot_dir = optarg; break; - case QEMU_OPTION_runas: - run_as = optarg; - break; case QEMU_OPTION_nvram: nvram = optarg; break; @@ -3641,14 +3635,6 @@ int main(int argc, char **argv, char **envp) exit(1); } - if (run_as) { - pwd = getpwnam(run_as); - if (!pwd) { - fprintf(stderr, "User \"%s\" doesn't exist\n", run_as); - exit(1); - } - } - if (chroot_dir) { if (chroot(chroot_dir) < 0) { fprintf(stderr, "chroot failed\n"); @@ -3660,20 +3646,7 @@ int main(int argc, char **argv, char **envp) } } - if (run_as) { - if (setgid(pwd->pw_gid) < 0) { - fprintf(stderr, "Failed to setgid(%d)\n", pwd->pw_gid); - exit(1); - } - if (setuid(pwd->pw_uid) < 0) { - fprintf(stderr, "Failed to setuid(%d)\n", pwd->pw_uid); - exit(1); - } - if (setuid(0) != -1) { - fprintf(stderr, "Dropping privileges failed\n"); - exit(1); - } - } + os_change_process_uid(); if (daemonize) { dup2(fd, 0); |