[virt-tools-list] [virt-viewer 4/4] ovirt: Only set SPICE CA cert if it's non NULL

Christophe Fergeau cfergeau at redhat.com
Tue Oct 29 17:53:35 UTC 2013


We currently reuse the oVirt CA cert for SPICE connection as well,
but it may not be set. When this happens, we don't want to try to use
it.
---
 src/remote-viewer.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index c2d77d2..3b7b804 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -808,14 +808,18 @@ create_ovirt_session(VirtViewerApp *app, const char *uri)
         SpiceSession *session;
         GByteArray *ca_cert;
 
-        g_object_get(G_OBJECT(proxy), "ca-cert", &ca_cert, NULL);
         session = remote_viewer_get_spice_session(REMOTE_VIEWER(app));
         g_object_set(G_OBJECT(session),
-                     "ca", ca_cert,
                      "password", ticket,
                      "cert-subject", host_subject,
                      NULL);
-        g_byte_array_unref(ca_cert);
+        g_object_get(G_OBJECT(proxy), "ca-cert", &ca_cert, NULL);
+        if (ca_cert != NULL) {
+            g_object_set(G_OBJECT(session),
+                    "ca", ca_cert,
+                    NULL);
+            g_byte_array_unref(ca_cert);
+        }
     }
 #endif
 
-- 
1.8.3.1




More information about the virt-tools-list mailing list