[dbus PATCH 5/8] Implement Secure property for Connect Interface

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

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 data/org.libvirt.Connect.xml |  4 ++++
 src/connect.c                | 20 ++++++++++++++++++++
 test/test_connect.py         |  1 +
 3 files changed, 25 insertions(+)

diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index 3791251..8416339 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -19,6 +19,10 @@
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetLibVersion"/>
     </property>
+    <property name="Secure" type="b" access="read">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-host.html#virConnectIsSecure"/>
+    </property>
     <property name="Version" type="t" access="read">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetVersion"/>
diff --git a/src/connect.c b/src/connect.c
index 4d90fc4..9bf08c8 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -166,6 +166,25 @@ virtDBusConnectGetLibVersion(const gchar *objectPath G_GNUC_UNUSED,
     *value = g_variant_new("t", libVer);
 }
 
+static void
+virtDBusConnectGetSecure(const gchar *objectPath G_GNUC_UNUSED,
+                         gpointer userData,
+                         GVariant **value,
+                         GError **error)
+{
+    virtDBusConnect *connect = userData;
+    gint secure;
+
+    if (!virtDBusConnectOpen(connect, error))
+        return;
+
+    secure = virConnectIsEncrypted(connect->connection);
+    if (secure < 0)
+        return virtDBusUtilSetLastVirtError(error);
+
+    *value = g_variant_new("b", !!secure);
+}
+
 static void
 virtDBusConnectGetVersion(const gchar *objectPath G_GNUC_UNUSED,
                           gpointer userData,
@@ -522,6 +541,7 @@ static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] = {
     { "Encrypted", virtDBusConnectGetEncrypted, NULL },
     { "Hostname", virtDBusConnectGetHostname, NULL },
     { "LibVersion", virtDBusConnectGetLibVersion, NULL },
+    { "Secure", virtDBusConnectGetSecure, NULL },
     { "Version", virtDBusConnectGetVersion, NULL },
     { 0 }
 };
diff --git a/test/test_connect.py b/test/test_connect.py
index 91c8bb6..d698a53 100755
--- a/test/test_connect.py
+++ b/test/test_connect.py
@@ -85,6 +85,7 @@ class TestConnect(libvirttest.BaseTestClass):
         ("Encrypted", dbus.Boolean),
         ("Hostname", dbus.String),
         ("LibVersion", dbus.UInt64),
+        ("Secure", dbus.Boolean),
         ("Version", dbus.UInt64),
     ])
     def test_connect_properties_return_type(self, property_name, expected_type):
-- 
2.15.0

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

  Powered by Linux