[libvirt] [PATCH v2] remote: Refuse connecting to remote socket

Michal Privoznik mprivozn at redhat.com
Wed Aug 24 09:41:14 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. Connecting to remote socket is not
supported and user should have used TLS/TCP/SSH instead.
---
 src/remote/remote_driver.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 28f333b..563ccf4 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -325,9 +325,16 @@ 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")) {
+                    if (conn->uri->server) {
+                        remoteError(VIR_ERR_INVALID_ARG, "%s",
+                                    _("rempte_open: using unix socket and "
+                                      "remote server is not supported."));
+                        return VIR_DRV_OPEN_ERROR;
+                    } 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