[libvirt] Enable authentication for all virConnectOpen calls in virsh

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

 



Hello,

virsh opens connections in three places (init, connect, migrate) but
only connections initiated from the command line (the -c option) are
opened with authentication.

The attached patch enables the two other places to use authentication too.

Ciao
Matthias
diff --git a/src/virsh.c b/src/virsh.c
index 9a7b0ed..abbd93b 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -468,13 +468,14 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
     ctl->name = vshStrdup(ctl, vshCommandOptString(cmd, "name", NULL));
 
     if (!ro) {
-        ctl->conn = virConnectOpen(ctl->name);
         ctl->readonly = 0;
     } else {
-        ctl->conn = virConnectOpenReadOnly(ctl->name);
         ctl->readonly = 1;
     }
 
+    ctl->conn = virConnectOpenAuth(ctl->name, virConnectAuthPtrDefault,
+                                   ctl->readonly ? VIR_CONNECT_RO : 0);
+
     if (!ctl->conn)
         vshError(ctl, FALSE, "%s", _("Failed to connect to the hypervisor"));
 
@@ -2315,7 +2316,7 @@ cmdMigrate (vshControl *ctl, const vshCmd *cmd)
         flags |= VIR_MIGRATE_LIVE;
 
     /* Temporarily connect to the destination host. */
-    dconn = virConnectOpen (desturi);
+    dconn = virConnectOpenAuth (desturi, virConnectAuthPtrDefault, 0);
     if (!dconn) goto done;
 
     /* Migrate. */
--
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]