9ae3a8
From e134588808798e0e2059bfc2bfcecea0f3287abf Mon Sep 17 00:00:00 2001
9ae3a8
From: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Date: Wed, 31 Jul 2013 14:03:26 +0200
9ae3a8
Subject: [PATCH 05/28] qga: save state directory in ga_install_service() -- RHEL-7 fixup
9ae3a8
9ae3a8
RH-Author: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Message-id: <1375279407-13573-6-git-send-email-lersek@redhat.com>
9ae3a8
Patchwork-id: 52866
9ae3a8
O-Subject: [RHEL-7 qemu-kvm PATCH 5/6] qga: save state directory in ga_install_service() -- RHEL-7 fixup
9ae3a8
Bugzilla: 964304
9ae3a8
RH-Acked-by: Michal Novotny <minovotn@redhat.com>
9ae3a8
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
If the user selects a non-default state directory at service installation
9ae3a8
time, we should remember it in the registered service.
9ae3a8
9ae3a8
In RHEL-7 we're getting the fix for CVE-2013-2231 and upstream commit
9ae3a8
9ae3a8
  a839ee77 qga: save state directory in ga_install_service()
9ae3a8
9ae3a8
in reverse order.
9ae3a8
9ae3a8
Qemu-1.6 saw "a839ee77" first, and the CVE fix second. For qemu-1.5.2,
9ae3a8
Mike Roth pulled in part of "a839ee77" as "31c6ed20", and then applied the
9ae3a8
CVE fix. This patch adds the rest of "a839ee77".
9ae3a8
9ae3a8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
---
9ae3a8
 qga/main.c |   10 +++++++++-
9ae3a8
 1 files changed, 9 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 qga/main.c |   10 +++++++++-
9ae3a8
 1 files changed, 9 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
diff --git a/qga/main.c b/qga/main.c
9ae3a8
index e49a6dd..0e04e73 100644
9ae3a8
--- a/qga/main.c
9ae3a8
+++ b/qga/main.c
9ae3a8
@@ -1023,7 +1023,15 @@ int main(int argc, char **argv)
9ae3a8
             service = optarg;
9ae3a8
             if (strcmp(service, "install") == 0) {
9ae3a8
                 const char *fixed_state_dir;
9ae3a8
-                return ga_install_service(path, log_filepath, state_dir);
9ae3a8
+
9ae3a8
+                /* If the user passed the "-t" option, we save that state dir
9ae3a8
+                 * in the service. Otherwise we let the service fetch the state
9ae3a8
+                 * dir from the environment when it starts.
9ae3a8
+                 */
9ae3a8
+                fixed_state_dir = (state_dir == dfl_pathnames.state_dir) ?
9ae3a8
+                                  NULL :
9ae3a8
+                                  state_dir;
9ae3a8
+                return ga_install_service(path, log_filepath, fixed_state_dir);
9ae3a8
             } else if (strcmp(service, "uninstall") == 0) {
9ae3a8
                 return ga_uninstall_service();
9ae3a8
             } else {
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8