thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
Blob Blame History Raw
From e134588808798e0e2059bfc2bfcecea0f3287abf Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Wed, 31 Jul 2013 14:03:26 +0200
Subject: [PATCH 05/28] qga: save state directory in ga_install_service() -- RHEL-7 fixup

RH-Author: Laszlo Ersek <lersek@redhat.com>
Message-id: <1375279407-13573-6-git-send-email-lersek@redhat.com>
Patchwork-id: 52866
O-Subject: [RHEL-7 qemu-kvm PATCH 5/6] qga: save state directory in ga_install_service() -- RHEL-7 fixup
Bugzilla: 964304
RH-Acked-by: Michal Novotny <minovotn@redhat.com>
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

If the user selects a non-default state directory at service installation
time, we should remember it in the registered service.

In RHEL-7 we're getting the fix for CVE-2013-2231 and upstream commit

  a839ee77 qga: save state directory in ga_install_service()

in reverse order.

Qemu-1.6 saw "a839ee77" first, and the CVE fix second. For qemu-1.5.2,
Mike Roth pulled in part of "a839ee77" as "31c6ed20", and then applied the
CVE fix. This patch adds the rest of "a839ee77".

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 qga/main.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 qga/main.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/qga/main.c b/qga/main.c
index e49a6dd..0e04e73 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -1023,7 +1023,15 @@ int main(int argc, char **argv)
             service = optarg;
             if (strcmp(service, "install") == 0) {
                 const char *fixed_state_dir;
-                return ga_install_service(path, log_filepath, state_dir);
+
+                /* If the user passed the "-t" option, we save that state dir
+                 * in the service. Otherwise we let the service fetch the state
+                 * dir from the environment when it starts.
+                 */
+                fixed_state_dir = (state_dir == dfl_pathnames.state_dir) ?
+                                  NULL :
+                                  state_dir;
+                return ga_install_service(path, log_filepath, fixed_state_dir);
             } else if (strcmp(service, "uninstall") == 0) {
                 return ga_uninstall_service();
             } else {
-- 
1.7.1