
On Fri, Sep 03, 2010 at 03:28:58PM +0200, Soren Hansen wrote:
If no uri is passed to one of the virConnectOpen-ish calls, libvirt attempts to autoprobe a sensible URI. Part of the current logic checks for getuid() > 0, and if that check is succesful, a libvirtd daemon is spawned. This patch replaces this check with a call to access(LIBVIRTD_PRIV_UNIX_SOCKET, W_OK) so that users with access to the qemu:///system UNIX socket connect to that one by default instead of spawning a new libvirtd daemon.
Signed-off-by: Soren Hansen <soren@linux2go.dk> --- src/remote/remote_driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index a945710..17e6ead 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1086,7 +1086,7 @@ remoteOpen (virConnectPtr conn, if (!conn->uri) { DEBUG0("Auto-probe remote URI"); #ifndef __sun - if (getuid() > 0) { + if (access(LIBVIRTD_PRIV_UNIX_SOCKET, W_OK)) { DEBUG0("Auto-spawn user daemon instance"); rflags |= VIR_DRV_OPEN_REMOTE_USER; if (!autostart ||
Hum, that sounds like a change of semantic. Before as non root you would span a local daemon, now you use the system one. I'm not saying it's a bad thing in most cases but it's a serious change, and we try to avoid those in general. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/