[PATCH 2/2 v3] remote: Refuse connecting to remote socket

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

 



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.
---
Although v2 was ACKed I send v3 so we have comprehensive picture.
And yeah, I've changed the error message.

 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..9ab897b 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",
+                                    _("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

--
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]