[libvirt] PATCH: DOn't use policykit if running non-root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the libvirtd daemon is running as non-root (ie a regular user) then
there is no point in defaulting policykit, since only clients of same
user account are able to connect to the UNIX socket anyway. This removes
the pointless login prompt when using qemu:///session.

Daniel

diff -r 9a457b847ffc qemud/qemud.c
--- a/qemud/qemud.c	Tue Jul 08 16:17:52 2008 +0100
+++ b/qemud/qemud.c	Wed Jul 09 09:24:53 2008 +0100
@@ -1926,6 +1926,14 @@
     GET_CONF_STR (conf, filename, tcp_port);
     GET_CONF_STR (conf, filename, listen_addr);
 
+#if HAVE_POLKIT
+    /* Change the default back to no auth for non-root */
+    if (getuid() != 0 && auth_unix_rw == REMOTE_AUTH_POLKIT)
+        auth_unix_rw = REMOTE_AUTH_NONE;
+    if (getuid() != 0 && auth_unix_ro == REMOTE_AUTH_POLKIT)
+        auth_unix_ro = REMOTE_AUTH_NONE;
+#endif
+
     if (remoteConfigGetAuth(conf, "auth_unix_rw", &auth_unix_rw, filename) < 0)
         goto free_and_fail;
 #if HAVE_POLKIT

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]