]> xenbits.xensource.com Git - libvirt.git/commitdiff
remote: Fix client crash when URI path is empty when using ssh
authorPeter Krempa <pkrempa@redhat.com>
Fri, 14 Jun 2013 08:41:29 +0000 (10:41 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 14 Jun 2013 08:41:29 +0000 (10:41 +0200)
The parsed path in the URI may be NULL resulting into:

  $ virsh -c qemu+ssh:// list
  Segmentation fault (core dumped)

Introduced by 22d81ceb46ea4b83ad817c29b2b04df27a09c671

src/remote/remote_driver.c

index bd5646adcd3388b0a969f20895282cb3ffe5d5d5..87c61f41573ace9868d81d7bbe686880c174bbde 100644 (file)
@@ -633,7 +633,7 @@ doRemoteOpen(virConnectPtr conn,
     case trans_libssh2:
         if (!sockname) {
             /* Right now we don't support default session connections */
-            if (STREQ(conn->uri->path, "/session")) {
+            if (STREQ_NULLABLE(conn->uri->path, "/session")) {
                 virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                                _("Connecting to session instance without "
                                  "socket path is not supported by the libssh2 "
@@ -710,7 +710,7 @@ doRemoteOpen(virConnectPtr conn,
 
         if (!sockname) {
             /* Right now we don't support default session connections */
-            if (STREQ(conn->uri->path, "/session")) {
+            if (STREQ_NULLABLE(conn->uri->path, "/session")) {
                 virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                                _("Connecting to session instance without "
                                  "socket path is not supported by the ssh "