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