Blame SOURCES/libvirt-admin-Fix-the-default-uri-for-session-daemon-to-libvirtd-session.patch

6ae9ed
From eb41dae660606b398ee7366829f9f5a41c686887 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <eb41dae660606b398ee7366829f9f5a41c686887@dist-git>
6ae9ed
From: Erik Skultety <eskultet@redhat.com>
6ae9ed
Date: Tue, 9 Aug 2016 16:09:21 +0200
6ae9ed
Subject: [PATCH] admin: Fix the default uri for session daemon to
6ae9ed
 libvirtd:///session
6ae9ed
6ae9ed
Just like we decide on which URI we go with based on EUID for qemu in remote
6ae9ed
driver, do a similar thing for admin except we do not spawn a daemon in this
6ae9ed
case.
6ae9ed
6ae9ed
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1356858
6ae9ed
6ae9ed
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6ae9ed
(cherry picked from commit 30ce2f0e2ad1335df6e4c9053eae822963531f97)
6ae9ed
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6ae9ed
6ae9ed
 Conflicts:
6ae9ed
	src/libvirt-admin.c - conflict caused by commit f5da0d18 which changed
6ae9ed
        the returned type of virAdmGetDefaultURI but was not backported
6ae9ed
---
6ae9ed
 src/libvirt-admin.c | 8 ++++++--
6ae9ed
 1 file changed, 6 insertions(+), 2 deletions(-)
6ae9ed
6ae9ed
diff --git a/src/libvirt-admin.c b/src/libvirt-admin.c
6ae9ed
index f07cb10..fb2f7b8 100644
6ae9ed
--- a/src/libvirt-admin.c
6ae9ed
+++ b/src/libvirt-admin.c
6ae9ed
@@ -181,9 +181,13 @@ virAdmGetDefaultURI(virConfPtr conf)
6ae9ed
         /* Since we can't probe connecting via any hypervisor driver as libvirt
6ae9ed
          * does, if no explicit URI was given and neither the environment
6ae9ed
          * variable, nor the configuration parameter had previously been set,
6ae9ed
-         * we set the default admin server URI to 'libvirtd://system'.
6ae9ed
+         * we set the default admin server URI to 'libvirtd:///system' or
6ae9ed
+         * 'libvirtd:///session' depending on the process's EUID.
6ae9ed
          */
6ae9ed
-        uristr = "libvirtd:///system";
6ae9ed
+        if (geteuid() == 0)
6ae9ed
+            uristr = "libvirtd:///system";
6ae9ed
+        else
6ae9ed
+            uristr = "libvirtd:///session";
6ae9ed
     }
6ae9ed
 
6ae9ed
     return uristr;
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed