[libvirt] [PATCH] remote: Switch to TLS when connecting to remote socket

Michal Privoznik mprivozn at redhat.com
Mon Aug 22 13:53:37 UTC 2011


If users wants to connect to remote unix socket, e.g.
'qemu+unix://<remote>/system' currently the <remote> part is ignored,
ending up connecting to localhost. This patch solves this issue by
creating TLS connection.
---
 src/remote/remote_driver.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index e5bfa4b..630c8ea 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -325,9 +325,14 @@ doRemoteOpen (virConnectPtr conn,
             } else {
                 if (STRCASEEQ (transport_str, "tls"))
                     transport = trans_tls;
-                else if (STRCASEEQ (transport_str, "unix"))
-                    transport = trans_unix;
-                else if (STRCASEEQ (transport_str, "ssh"))
+                else if (STRCASEEQ (transport_str, "unix")) {
+                    /* When connecting to unix socket on remote
+                     * machine use TLS to connect to it */
+                    if (conn->uri->server)
+                        transport = trans_tls;
+                    else
+                        transport = trans_unix;
+                } else if (STRCASEEQ (transport_str, "ssh"))
                     transport = trans_ssh;
                 else if (STRCASEEQ (transport_str, "ext"))
                     transport = trans_ext;
-- 
1.7.3.4




More information about the libvir-list mailing list