From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525877987397858.0286315072547; Wed, 9 May 2018 07:59:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D4A180472; Wed, 9 May 2018 14:59:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 605682010D09; Wed, 9 May 2018 14:59:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 340A4180BADB; Wed, 9 May 2018 14:59:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49Exe2x004968 for ; Wed, 9 May 2018 10:59:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6A1D82022DE3; Wed, 9 May 2018 14:59:40 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CCB72022DE2 for ; Wed, 9 May 2018 14:59:39 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:26 +0200 Message-Id: <20180509145938.18750-2-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 01/13] Introduce Secret Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 09 May 2018 14:59:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/Makefile.am | 1 + data/org.libvirt.Secret.xml | 7 +++++ src/Makefile.am | 1 + src/connect.c | 6 +++++ src/connect.h | 1 + src/secret.c | 64 +++++++++++++++++++++++++++++++++++++++++= ++++ src/secret.h | 9 +++++++ src/util.c | 33 +++++++++++++++++++++++ src/util.h | 16 ++++++++++++ 9 files changed, 138 insertions(+) create mode 100644 data/org.libvirt.Secret.xml create mode 100644 src/secret.c create mode 100644 src/secret.h diff --git a/data/Makefile.am b/data/Makefile.am index 4d2af45..5a085cd 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -22,6 +22,7 @@ interfaces_files =3D \ org.libvirt.Connect.xml \ org.libvirt.Domain.xml \ org.libvirt.Network.xml \ + org.libvirt.Secret.xml \ org.libvirt.StoragePool.xml interfacesdir =3D $(DBUS_INTERFACES_DIR) interfaces_DATA =3D $(interfaces_files) diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml new file mode 100644 index 0000000..1cc1e31 --- /dev/null +++ b/data/org.libvirt.Secret.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/src/Makefile.am b/src/Makefile.am index 5e082da..6b2887b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,6 +10,7 @@ DAEMON_SOURCES =3D \ events.c events.h \ gdbus.c gdbus.h \ network.c network.h \ + secret.c secret.h \ storagepool.c storagepool.h =20 EXTRA_DIST =3D \ diff --git a/src/connect.c b/src/connect.c index 79b5d8f..e56089a 100644 --- a/src/connect.c +++ b/src/connect.c @@ -2,6 +2,7 @@ #include "domain.h" #include "events.h" #include "network.h" +#include "secret.h" #include "storagepool.h" #include "util.h" =20 @@ -1217,6 +1218,7 @@ virtDBusConnectFree(virtDBusConnect *connect) =20 g_free(connect->domainPath); g_free(connect->networkPath); + g_free(connect->secretPath); g_free(connect->storagePoolPath); g_free(connect); } @@ -1270,6 +1272,10 @@ virtDBusConnectNew(virtDBusConnect **connectp, if (error && *error) return; =20 + virtDBusSecretRegister(connect, error); + if (error && *error) + return; + virtDBusStoragePoolRegister(connect, error); if (error && *error) return; diff --git a/src/connect.h b/src/connect.h index b4df048..5c83cc6 100644 --- a/src/connect.h +++ b/src/connect.h @@ -14,6 +14,7 @@ struct virtDBusConnect { const gchar *connectPath; gchar *domainPath; gchar *networkPath; + gchar *secretPath; gchar *storagePoolPath; virConnectPtr connection; GMutex lock; diff --git a/src/secret.c b/src/secret.c new file mode 100644 index 0000000..c7cbb02 --- /dev/null +++ b/src/secret.c @@ -0,0 +1,64 @@ +#include "secret.h" +#include "util.h" + +#include + +static virtDBusGDBusPropertyTable virtDBusSecretPropertyTable[] =3D { + { 0 } +}; + +static virtDBusGDBusMethodTable virtDBusSecretMethodTable[] =3D { + { 0 } +}; + +static gchar ** +virtDBusSecretEnumerate(gpointer userData) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecretPtr) secrets =3D NULL; + gint num =3D 0; + gchar **ret =3D NULL; + + if (!virtDBusConnectOpen(connect, NULL)) + return NULL; + + num =3D virConnectListAllSecrets(connect->connection, &secrets, 0); + if (num < 0) + return NULL; + + if (num =3D=3D 0) + return NULL; + + ret =3D g_new0(gchar *, num + 1); + + for (gint i =3D 0; i < num; i++) { + ret[i] =3D virtDBusUtilBusPathForVirSecret(secrets[i], + connect->secretPath); + } + + return ret; +} + +static GDBusInterfaceInfo *interfaceInfo; + +void +virtDBusSecretRegister(virtDBusConnect *connect, + GError **error) +{ + connect->secretPath =3D g_strdup_printf("%s/secret", connect->connectP= ath); + + if (!interfaceInfo) { + interfaceInfo =3D virtDBusGDBusLoadIntrospectData(VIRT_DBUS_SECRET= _INTERFACE, + error); + if (!interfaceInfo) + return; + } + + virtDBusGDBusRegisterSubtree(connect->bus, + connect->secretPath, + interfaceInfo, + virtDBusSecretEnumerate, + virtDBusSecretMethodTable, + virtDBusSecretPropertyTable, + connect); +} diff --git a/src/secret.h b/src/secret.h new file mode 100644 index 0000000..4b3846b --- /dev/null +++ b/src/secret.h @@ -0,0 +1,9 @@ +#pragma once + +#include "connect.h" + +#define VIRT_DBUS_SECRET_INTERFACE "org.libvirt.Secret" + +void +virtDBusSecretRegister(virtDBusConnect *connect, + GError **error); diff --git a/src/util.c b/src/util.c index e90be3b..9dd901c 100644 --- a/src/util.c +++ b/src/util.c @@ -256,6 +256,39 @@ virtDBusUtilStringListFree(virtDBusCharArray *item) g_free(item); } =20 +virSecretPtr +virtDBusUtilVirSecretFromBusPath(virConnectPtr connection, + const gchar *path, + const gchar *secretPath) +{ + g_autofree gchar *name =3D NULL; + gsize prefixLen =3D strlen(secretPath) + 1; + + name =3D virtDBusUtilDecodeUUID(path + prefixLen); + + return virSecretLookupByUUIDString(connection, name); +} + +gchar * +virtDBusUtilBusPathForVirSecret(virSecretPtr secret, + const gchar *secretPath) +{ + gchar uuid[VIR_UUID_STRING_BUFLEN] =3D ""; + g_autofree gchar *newUuid =3D NULL; + virSecretGetUUIDString(secret, uuid); + newUuid =3D virtDBusUtilEncodeUUID(uuid); + return g_strdup_printf("%s/%s", secretPath, newUuid); +} + +void +virtDBusUtilVirSecretListFree(virSecretPtr *secrets) +{ + for (gint i =3D 0; secrets[i] !=3D NULL; i++) + virSecretFree(secrets[i]); + + g_free(secrets); +} + virStoragePoolPtr virtDBusUtilVirStoragePoolFromBusPath(virConnectPtr connection, const gchar *path, diff --git a/src/util.h b/src/util.h index d932b66..2f37933 100644 --- a/src/util.h +++ b/src/util.h @@ -79,6 +79,22 @@ virtDBusUtilStringListFree(virtDBusCharArray *item); =20 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virtDBusCharArray, virtDBusUtilStringListFre= e); =20 +virSecretPtr +virtDBusUtilVirSecretFromBusPath(virConnectPtr connection, + const gchar *path, + const gchar *secretPath); + +gchar * +virtDBusUtilBusPathForVirSecret(virSecretPtr secret, + const gchar *secretPath); + +void +virtDBusUtilVirSecretListFree(virSecretPtr *secrets); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSecret, virSecretFree); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSecretPtr, + virtDBusUtilVirSecretListFree); + virStoragePoolPtr virtDBusUtilVirStoragePoolFromBusPath(virConnectPtr connection, const gchar *path, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878006652561.1772860177621; Wed, 9 May 2018 08:00:06 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8891D30B8F88; Wed, 9 May 2018 15:00:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 49DAE30012AF; Wed, 9 May 2018 15:00:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A54314CAAF; Wed, 9 May 2018 15:00:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49ExfSu004977 for ; Wed, 9 May 2018 10:59:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0F47E2022DE2; Wed, 9 May 2018 14:59:41 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6E6C2022DE4 for ; Wed, 9 May 2018 14:59:40 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:27 +0200 Message-Id: <20180509145938.18750-3-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 02/13] Implement ListSecrets method for Connect Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 09 May 2018 15:00:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Connect.xml | 6 ++++++ src/connect.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 0c009cd..df91108 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -145,6 +145,12 @@ + + + + + diff --git a/src/connect.c b/src/connect.c index e56089a..5732d8a 100644 --- a/src/connect.c +++ b/src/connect.c @@ -720,6 +720,42 @@ virtDBusConnectListNetworks(GVariant *inArgs, *outArgs =3D g_variant_new_tuple(&gnetworks, 1); } =20 +static void +virtDBusConnectListSecrets(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecretPtr) secrets =3D NULL; + guint flags; + GVariantBuilder builder; + GVariant *gsecrets; + + g_variant_get(inArgs, "(u)", &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + if (virConnectListAllSecrets(connect->connection, &secrets, flags) < 0) + return virtDBusUtilSetLastVirtError(error); + + g_variant_builder_init(&builder, G_VARIANT_TYPE("ao")); + + for (gint i =3D 0; secrets[i]; i++) { + g_autofree gchar *path =3D NULL; + path =3D virtDBusUtilBusPathForVirSecret(secrets[i], connect->secr= etPath); + + g_variant_builder_add(&builder, "o", path); + } + + gsecrets =3D g_variant_builder_end(&builder); + *outArgs =3D g_variant_new_tuple(&gsecrets, 1); +} + static void virtDBusConnectListStoragePools(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1191,6 +1227,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "GetSysinfo", virtDBusConnectGetSysinfo }, { "ListDomains", virtDBusConnectListDomains }, { "ListNetworks", virtDBusConnectListNetworks }, + { "ListSecrets", virtDBusConnectListSecrets }, { "ListStoragePools", virtDBusConnectListStoragePools }, { "NetworkCreateXML", virtDBusConnectNetworkCreateXML }, { "NetworkDefineXML", virtDBusConnectNetworkDefineXML }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878014112118.53144109412835; Wed, 9 May 2018 08:00:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F3AD7624C3; Wed, 9 May 2018 15:00:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 523526FEE2; Wed, 9 May 2018 15:00:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EEC274CAB0; Wed, 9 May 2018 15:00:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49Exffw004984 for ; Wed, 9 May 2018 10:59:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id A8CEC2022DE2; Wed, 9 May 2018 14:59:41 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C61B2022DE3 for ; Wed, 9 May 2018 14:59:41 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:28 +0200 Message-Id: <20180509145938.18750-4-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 03/13] Register Secret Lifecycle Events X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 09 May 2018 15:00:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Connect.xml | 7 +++++++ src/connect.c | 13 +++++++++++++ src/connect.h | 1 + src/events.c | 42 ++++++++++++++++++++++++++++++++++++++++= ++ 4 files changed, 63 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index df91108..3aae9fe 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -248,6 +248,13 @@ + + + + + + diff --git a/src/connect.c b/src/connect.c index 5732d8a..6b96888 100644 --- a/src/connect.c +++ b/src/connect.c @@ -61,6 +61,16 @@ virtDBusConnectClose(virtDBusConnect *connect, } } =20 + for (gint i =3D 0; i < VIR_SECRET_EVENT_ID_LAST; i++) { + if (connect->secretCallbackIds[i] >=3D 0) { + if (deregisterEvents) { + virConnectSecretEventDeregisterAny(connect->connection, + connect->secretCallback= Ids[i]); + } + connect->secretCallbackIds[i] =3D -1; + } + } + for (gint i =3D 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) { if (connect->storagePoolCallbackIds[i] >=3D 0) { if (deregisterEvents) { @@ -1287,6 +1297,9 @@ virtDBusConnectNew(virtDBusConnect **connectp, for (gint i =3D 0; i < VIR_NETWORK_EVENT_ID_LAST; i++) connect->networkCallbackIds[i] =3D -1; =20 + for (gint i =3D 0; i < VIR_SECRET_EVENT_ID_LAST; i++) + connect->secretCallbackIds[i] =3D -1; + for (gint i =3D 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) connect->storagePoolCallbackIds[i] =3D -1; =20 diff --git a/src/connect.h b/src/connect.h index 5c83cc6..08e1b68 100644 --- a/src/connect.h +++ b/src/connect.h @@ -21,6 +21,7 @@ struct virtDBusConnect { =20 gint domainCallbackIds[VIR_DOMAIN_EVENT_ID_LAST]; gint networkCallbackIds[VIR_NETWORK_EVENT_ID_LAST]; + gint secretCallbackIds[VIR_SECRET_EVENT_ID_LAST]; gint storagePoolCallbackIds[VIR_STORAGE_POOL_EVENT_ID_LAST]; }; typedef struct virtDBusConnect virtDBusConnect; diff --git a/src/events.c b/src/events.c index 04967c2..53cd725 100644 --- a/src/events.c +++ b/src/events.c @@ -143,6 +143,29 @@ virtDBusEventsNetworkLifecycle(virConnectPtr connectio= n G_GNUC_UNUSED, return 0; } =20 +static gint +virtDBusEventsSecretLifecycle(virConnectPtr connection G_GNUC_UNUSED, + virSecretPtr secret, + gint event, + gint detail, + gpointer opaque) +{ + virtDBusConnect *connect =3D opaque; + g_autofree gchar *path =3D NULL; + + path =3D virtDBusUtilBusPathForVirSecret(secret, connect->secretPath); + + g_dbus_connection_emit_signal(connect->bus, + NULL, + connect->connectPath, + VIRT_DBUS_CONNECT_INTERFACE, + "SecretEvent", + g_variant_new("(ouu)", path, event, deta= il), + NULL); + + return 0; +} + static gint virtDBusEventsStoragePoolLifecycle(virConnectPtr connection G_GNUC_UNUSED, virStoragePoolPtr storagePool, @@ -197,6 +220,21 @@ virtDBusEventsRegisterNetworkEvent(virtDBusConnect *co= nnect, NU= LL); } =20 +static void +virtDBusEventsRegisterSecretEvent(virtDBusConnect *connect, + gint id, + virConnectSecretEventGenericCallback cal= lback) +{ + g_assert(connect->secretCallbackIds[id] =3D=3D -1); + + connect->secretCallbackIds[id] =3D virConnectSecretEventRegisterAny(co= nnect->connection, + NULL, + id, + VIR_= SECRET_EVENT_CALLBACK(callback), + conn= ect, + NULL= ); +} + static void virtDBusEventsRegisterStoragePoolEvent(virtDBusConnect *connect, gint id, @@ -239,6 +277,10 @@ virtDBusEventsRegister(virtDBusConnect *connect) VIR_NETWORK_EVENT_ID_LIFECYCLE, VIR_NETWORK_EVENT_CALLBACK(virtDBus= EventsNetworkLifecycle)); =20 + virtDBusEventsRegisterSecretEvent(connect, + VIR_SECRET_EVENT_ID_LIFECYCLE, + VIR_SECRET_EVENT_CALLBACK(virtDBusEv= entsSecretLifecycle)); + virtDBusEventsRegisterStoragePoolEvent(connect, VIR_STORAGE_POOL_EVENT_ID_LIFEC= YCLE, VIR_STORAGE_POOL_EVENT_CALLBACK= (virtDBusEventsStoragePoolLifecycle)); --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878047120559.6018466001498; Wed, 9 May 2018 08:00:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 54EFC30014D2; Wed, 9 May 2018 15:00:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A6E6E30001DB; Wed, 9 May 2018 15:00:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3C7004CAAA; Wed, 9 May 2018 15:00:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49Exgpp004989 for ; Wed, 9 May 2018 10:59:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E0142022DE2; Wed, 9 May 2018 14:59:42 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5BB22022DE3 for ; Wed, 9 May 2018 14:59:41 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:29 +0200 Message-Id: <20180509145938.18750-5-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 04/13] Implement UUID property for Secret Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 09 May 2018 15:00:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Secret.xml | 5 +++++ src/secret.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml index 1cc1e31..8ee6f0c 100644 --- a/data/org.libvirt.Secret.xml +++ b/data/org.libvirt.Secret.xml @@ -3,5 +3,10 @@ =20 + + + + diff --git a/src/secret.c b/src/secret.c index c7cbb02..1780d96 100644 --- a/src/secret.c +++ b/src/secret.c @@ -3,7 +3,49 @@ =20 #include =20 +static virSecretPtr +virtDBusSecretGetVirSecret(virtDBusConnect *connect, + const gchar *objectPath, + GError **error) +{ + virSecretPtr secret; + + if (virtDBusConnectOpen(connect, error) < 0) + return NULL; + + secret =3D virtDBusUtilVirSecretFromBusPath(connect->connection, + objectPath, + connect->secretPath); + if (!secret) { + virtDBusUtilSetLastVirtError(error); + return NULL; + } + + return secret; +} + +static void +virtDBusSecretGetUUID(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecret) secret =3D NULL; + gchar uuid[VIR_UUID_STRING_BUFLEN] =3D ""; + + secret =3D virtDBusSecretGetVirSecret(connect, objectPath, error); + if (!secret) + return; + + if (virSecretGetUUIDString(secret, uuid) < 0) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("s", uuid); +} + static virtDBusGDBusPropertyTable virtDBusSecretPropertyTable[] =3D { + { "UUID", virtDBusSecretGetUUID, NULL }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878026894631.7553571024067; Wed, 9 May 2018 08:00:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 52A26C01CB95; Wed, 9 May 2018 15:00:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EFE4316BF9; Wed, 9 May 2018 15:00:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 38D4E180BAE7; Wed, 9 May 2018 15:00:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49Exhlx005002 for ; Wed, 9 May 2018 10:59:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0A6382022DE2; Wed, 9 May 2018 14:59:43 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B6B82022DE3 for ; Wed, 9 May 2018 14:59:42 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:30 +0200 Message-Id: <20180509145938.18750-6-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 05/13] Implement UsageID property for Secret Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 09 May 2018 15:00:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Secret.xml | 5 +++++ src/secret.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml index 8ee6f0c..5cce9d3 100644 --- a/data/org.libvirt.Secret.xml +++ b/data/org.libvirt.Secret.xml @@ -8,5 +8,10 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-secret.html#= virSecretGetUUIDString"/> + + + + diff --git a/src/secret.c b/src/secret.c index 1780d96..ef0ebcd 100644 --- a/src/secret.c +++ b/src/secret.c @@ -44,8 +44,30 @@ virtDBusSecretGetUUID(const gchar *objectPath, *value =3D g_variant_new("s", uuid); } =20 +static void +virtDBusSecretGetUsageID(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecret) secret =3D NULL; + const gchar *usageID; + + secret =3D virtDBusSecretGetVirSecret(connect, objectPath, error); + if (!secret) + return; + + usageID =3D virSecretGetUsageID(secret); + if (!usageID) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("s", usageID); +} + static virtDBusGDBusPropertyTable virtDBusSecretPropertyTable[] =3D { { "UUID", virtDBusSecretGetUUID, NULL }, + { "UsageID", virtDBusSecretGetUsageID, NULL }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878051873940.1093838129633; Wed, 9 May 2018 08:00:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 22F8180473; Wed, 9 May 2018 15:00:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE5632015883; Wed, 9 May 2018 15:00:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7041C180BAE5; Wed, 9 May 2018 15:00:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49ExhEq005009 for ; Wed, 9 May 2018 10:59:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id A434A2022DE2; Wed, 9 May 2018 14:59:43 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 481282022DE3 for ; Wed, 9 May 2018 14:59:43 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:31 +0200 Message-Id: <20180509145938.18750-7-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 06/13] Implement UsageType property for Secret Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 09 May 2018 15:00:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Secret.xml | 5 +++++ src/secret.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml index 5cce9d3..4270182 100644 --- a/data/org.libvirt.Secret.xml +++ b/data/org.libvirt.Secret.xml @@ -13,5 +13,10 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-secret.html#= virSecretGetUsageID"/> + + + + diff --git a/src/secret.c b/src/secret.c index ef0ebcd..25b1934 100644 --- a/src/secret.c +++ b/src/secret.c @@ -65,9 +65,31 @@ virtDBusSecretGetUsageID(const gchar *objectPath, *value =3D g_variant_new("s", usageID); } =20 +static void +virtDBusSecretGetUsageType(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecret) secret =3D NULL; + gint usageType; + + secret =3D virtDBusSecretGetVirSecret(connect, objectPath, error); + if (!secret) + return; + + usageType =3D virSecretGetUsageType(secret); + if (usageType < 0) + return virtDBusUtilSetLastVirtError(error); + + *value =3D g_variant_new("u", usageType); +} + static virtDBusGDBusPropertyTable virtDBusSecretPropertyTable[] =3D { { "UUID", virtDBusSecretGetUUID, NULL }, { "UsageID", virtDBusSecretGetUsageID, NULL }, + { "UsageType", virtDBusSecretGetUsageType, NULL }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878013708612.8417460451291; Wed, 9 May 2018 08:00:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A1F312820D; Wed, 9 May 2018 15:00:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4875165972; Wed, 9 May 2018 15:00:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E9BC0180BAE9; Wed, 9 May 2018 15:00:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49ExiLg005014 for ; Wed, 9 May 2018 10:59:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 494882022DE2; Wed, 9 May 2018 14:59:44 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0DC92022DE3 for ; Wed, 9 May 2018 14:59:43 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:32 +0200 Message-Id: <20180509145938.18750-8-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 07/13] Implement GetXMLDesc method for Secret Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 09 May 2018 15:00:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Secret.xml | 6 ++++++ src/secret.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml index 4270182..d35af38 100644 --- a/data/org.libvirt.Secret.xml +++ b/data/org.libvirt.Secret.xml @@ -18,5 +18,11 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-secret.html#= virSecretGetUsageType"/> + + + + + diff --git a/src/secret.c b/src/secret.c index 25b1934..28b1852 100644 --- a/src/secret.c +++ b/src/secret.c @@ -86,6 +86,33 @@ virtDBusSecretGetUsageType(const gchar *objectPath, *value =3D g_variant_new("u", usageType); } =20 +static void +virtDBusSecretGetXMLDesc(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecret) secret =3D NULL; + g_autofree gchar *xml =3D NULL; + guint flags; + + g_variant_get(inArgs, "(u)", &flags); + + secret =3D virtDBusSecretGetVirSecret(connect, objectPath, error); + if (!secret) + return; + + xml =3D virSecretGetXMLDesc(secret, flags); + if (!xml) + return virtDBusUtilSetLastVirtError(error); + + *outArgs =3D g_variant_new("(s)", xml); +} + static virtDBusGDBusPropertyTable virtDBusSecretPropertyTable[] =3D { { "UUID", virtDBusSecretGetUUID, NULL }, { "UsageID", virtDBusSecretGetUsageID, NULL }, @@ -94,6 +121,7 @@ static virtDBusGDBusPropertyTable virtDBusSecretProperty= Table[] =3D { }; =20 static virtDBusGDBusMethodTable virtDBusSecretMethodTable[] =3D { + { "GetXMLDesc", virtDBusSecretGetXMLDesc }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878059676901.2335090974519; Wed, 9 May 2018 08:00:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A17F9820E6; Wed, 9 May 2018 15:00:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 548C763B81; Wed, 9 May 2018 15:00:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D3CC9180BAE8; Wed, 9 May 2018 15:00:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49Exj9U005023 for ; Wed, 9 May 2018 10:59:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id E20172022DE2; Wed, 9 May 2018 14:59:44 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85CAF2022DE3 for ; Wed, 9 May 2018 14:59:44 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:33 +0200 Message-Id: <20180509145938.18750-9-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 08/13] Implement SecretLookupByUUID method for Connect Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 09 May 2018 15:00:58 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Connect.xml | 6 ++++++ src/connect.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index 3aae9fe..cb70af9 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -223,6 +223,12 @@ + + + + + diff --git a/src/connect.c b/src/connect.c index 6b96888..70b2ee8 100644 --- a/src/connect.c +++ b/src/connect.c @@ -1151,6 +1151,34 @@ virtDBusConnectNodeSetMemoryParameters(GVariant *inA= rgs, } } =20 +static void +virtDBusConnectSecretLookupByUUID(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecret) secret =3D NULL; + g_autofree gchar *path =3D NULL; + const gchar *uuidstr; + + g_variant_get(inArgs, "(s)", &uuidstr); + + if (!virtDBusConnectOpen(connect, error)) + return; + + secret =3D virSecretLookupByUUIDString(connect->connection, uuidstr); + if (!secret) + return virtDBusUtilSetLastVirtError(error); + + path =3D virtDBusUtilBusPathForVirSecret(secret, connect->secretPath); + + *outArgs =3D g_variant_new("(o)", path); +} + static void virtDBusConnectStoragePoolLookupByName(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1250,6 +1278,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "NodeGetMemoryStats", virtDBusConnectNodeGetMemoryStats }, { "NodeGetSecurityModel", virtDBusConnectNodeGetSecurityModel }, { "NodeSetMemoryParameters", virtDBusConnectNodeSetMemoryParameters }, + { "SecretLookupByUUID", virtDBusConnectSecretLookupByUUID }, { "StoragePoolLookupByName", virtDBusConnectStoragePoolLookupByName }, { "StoragePoolLookupByUUID", virtDBusConnectStoragePoolLookupByUUID }, { 0 } --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878018921298.8900996685783; Wed, 9 May 2018 08:00:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C15843004429; Wed, 9 May 2018 15:00:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8810D30012D3; Wed, 9 May 2018 15:00:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 369794CAB7; Wed, 9 May 2018 15:00:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49ExjaS005037 for ; Wed, 9 May 2018 10:59:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 876602022DE2; Wed, 9 May 2018 14:59:45 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A79E2022DE3 for ; Wed, 9 May 2018 14:59:45 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:34 +0200 Message-Id: <20180509145938.18750-10-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 09/13] Implement SecretLookupByUsage method for Connect Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 09 May 2018 15:00:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Connect.xml | 7 +++++++ src/connect.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index cb70af9..fc29165 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -229,6 +229,13 @@ + + + + + + diff --git a/src/connect.c b/src/connect.c index 70b2ee8..3ef068f 100644 --- a/src/connect.c +++ b/src/connect.c @@ -1179,6 +1179,35 @@ virtDBusConnectSecretLookupByUUID(GVariant *inArgs, *outArgs =3D g_variant_new("(o)", path); } =20 +static void +virtDBusConnectSecretLookupByUsage(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecret) secret =3D NULL; + g_autofree gchar *path =3D NULL; + gint usageType; + const gchar *usageID; + + g_variant_get(inArgs, "(i&s)", &usageType, &usageID); + + if (!virtDBusConnectOpen(connect, error)) + return; + + secret =3D virSecretLookupByUsage(connect->connection, usageType, usag= eID); + if (!secret) + return virtDBusUtilSetLastVirtError(error); + + path =3D virtDBusUtilBusPathForVirSecret(secret, connect->secretPath); + + *outArgs =3D g_variant_new("(o)", path); +} + static void virtDBusConnectStoragePoolLookupByName(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1279,6 +1308,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "NodeGetSecurityModel", virtDBusConnectNodeGetSecurityModel }, { "NodeSetMemoryParameters", virtDBusConnectNodeSetMemoryParameters }, { "SecretLookupByUUID", virtDBusConnectSecretLookupByUUID }, + { "SecretLookupByUsage", virtDBusConnectSecretLookupByUsage }, { "StoragePoolLookupByName", virtDBusConnectStoragePoolLookupByName }, { "StoragePoolLookupByUUID", virtDBusConnectStoragePoolLookupByUUID }, { 0 } --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878021687293.50917355711283; Wed, 9 May 2018 08:00:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D09CA31316DF; Wed, 9 May 2018 15:00:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 931D010840DA; Wed, 9 May 2018 15:00:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3E9BD4CABC; Wed, 9 May 2018 15:00:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49ExkbE005047 for ; Wed, 9 May 2018 10:59:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 36C2F2022DE2; Wed, 9 May 2018 14:59:46 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDF142022DE3 for ; Wed, 9 May 2018 14:59:45 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:35 +0200 Message-Id: <20180509145938.18750-11-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 10/13] Implement Undefine method for Secret Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 09 May 2018 15:00:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Secret.xml | 4 ++++ src/secret.c | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml index d35af38..509c46a 100644 --- a/data/org.libvirt.Secret.xml +++ b/data/org.libvirt.Secret.xml @@ -24,5 +24,9 @@ + + + diff --git a/src/secret.c b/src/secret.c index 28b1852..ecbd809 100644 --- a/src/secret.c +++ b/src/secret.c @@ -113,6 +113,26 @@ virtDBusSecretGetXMLDesc(GVariant *inArgs, *outArgs =3D g_variant_new("(s)", xml); } =20 +static void +virtDBusSecretUndefine(GVariant *inArgs G_GNUC_UNUSED, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecret) secret =3D NULL; + + secret =3D virtDBusSecretGetVirSecret(connect, objectPath, error); + if (!secret) + return; + + if (virSecretUndefine(secret) < 0) + virtDBusUtilSetLastVirtError(error); +} + static virtDBusGDBusPropertyTable virtDBusSecretPropertyTable[] =3D { { "UUID", virtDBusSecretGetUUID, NULL }, { "UsageID", virtDBusSecretGetUsageID, NULL }, @@ -122,6 +142,7 @@ static virtDBusGDBusPropertyTable virtDBusSecretPropert= yTable[] =3D { =20 static virtDBusGDBusMethodTable virtDBusSecretMethodTable[] =3D { { "GetXMLDesc", virtDBusSecretGetXMLDesc }, + { "Undefine", virtDBusSecretUndefine }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878067920367.3144599593951; Wed, 9 May 2018 08:01:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 58D8E30BB908; Wed, 9 May 2018 15:01:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA26130001DB; Wed, 9 May 2018 15:01:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 69EDD180BAE8; Wed, 9 May 2018 15:01:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49Exl8o005054 for ; Wed, 9 May 2018 10:59:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id E22862022DE2; Wed, 9 May 2018 14:59:46 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 739872022DE3 for ; Wed, 9 May 2018 14:59:46 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:36 +0200 Message-Id: <20180509145938.18750-12-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 11/13] Implement GetValue method for Secret Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 09 May 2018 15:01:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Secret.xml | 6 ++++++ src/secret.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml index 509c46a..563167b 100644 --- a/data/org.libvirt.Secret.xml +++ b/data/org.libvirt.Secret.xml @@ -18,6 +18,12 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-secret.html#= virSecretGetUsageType"/> + + + + + diff --git a/src/secret.c b/src/secret.c index ecbd809..653dc5c 100644 --- a/src/secret.c +++ b/src/secret.c @@ -86,6 +86,42 @@ virtDBusSecretGetUsageType(const gchar *objectPath, *value =3D g_variant_new("u", usageType); } =20 +static void +virtDBusSecretGetValue(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecret) secret =3D NULL; + g_autofree guchar *value =3D NULL; + gsize size; + guint flags; + GVariantBuilder builder; + GVariant *res; + + g_variant_get(inArgs, "(u)", &flags); + + secret =3D virtDBusSecretGetVirSecret(connect, objectPath, error); + if (!secret) + return; + + value =3D virSecretGetValue(secret, &size, flags); + if (!value) + return virtDBusUtilSetLastVirtError(error); + + g_variant_builder_init(&builder, G_VARIANT_TYPE("ay")); + for (unsigned int i =3D 0; i < size; i++) + g_variant_builder_add(&builder, "y", value[i]); + + res =3D g_variant_builder_end(&builder); + + *outArgs =3D g_variant_new_tuple(&res, 1); +} + static void virtDBusSecretGetXMLDesc(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -143,6 +179,7 @@ static virtDBusGDBusPropertyTable virtDBusSecretPropert= yTable[] =3D { static virtDBusGDBusMethodTable virtDBusSecretMethodTable[] =3D { { "GetXMLDesc", virtDBusSecretGetXMLDesc }, { "Undefine", virtDBusSecretUndefine }, + { "GetValue", virtDBusSecretGetValue }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878024683487.1504807018757; Wed, 9 May 2018 08:00:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 91A67316D456; Wed, 9 May 2018 15:00:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A5B6A0FA1; Wed, 9 May 2018 15:00:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9411B180BAED; Wed, 9 May 2018 15:00:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49Exl1w005062 for ; Wed, 9 May 2018 10:59:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 86A222022DE2; Wed, 9 May 2018 14:59:47 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A7F12022DE3 for ; Wed, 9 May 2018 14:59:47 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:37 +0200 Message-Id: <20180509145938.18750-13-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 12/13] Implement SetValue method for Secret Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 09 May 2018 15:00:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Secret.xml | 6 ++++++ src/secret.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml index 563167b..3a5d742 100644 --- a/data/org.libvirt.Secret.xml +++ b/data/org.libvirt.Secret.xml @@ -30,6 +30,12 @@ + + + + + diff --git a/src/secret.c b/src/secret.c index 653dc5c..028a7b4 100644 --- a/src/secret.c +++ b/src/secret.c @@ -149,6 +149,39 @@ virtDBusSecretGetXMLDesc(GVariant *inArgs, *outArgs =3D g_variant_new("(s)", xml); } =20 +static void +virtDBusSecretSetValue(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs G_GNUC_UNUSED, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecret) secret =3D NULL; + g_autoptr(GVariantIter) iter =3D NULL; + guint flags; + g_autofree guchar *value =3D NULL; + guchar *tmp; + gsize size; + + g_variant_get(inArgs, "(ayu)", &iter, &flags); + + secret =3D virtDBusSecretGetVirSecret(connect, objectPath, error); + if (!secret) + return; + + size =3D g_variant_iter_n_children(iter); + value =3D g_new0(guchar, size); + tmp =3D value; + while (g_variant_iter_next(iter, "y", tmp)) + tmp++; + + if (virSecretSetValue(secret, value, size, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusSecretUndefine(GVariant *inArgs G_GNUC_UNUSED, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -180,6 +213,7 @@ static virtDBusGDBusMethodTable virtDBusSecretMethodTab= le[] =3D { { "GetXMLDesc", virtDBusSecretGetXMLDesc }, { "Undefine", virtDBusSecretUndefine }, { "GetValue", virtDBusSecretGetValue }, + { "SetValue", virtDBusSecretSetValue }, { 0 } }; =20 --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 06:25:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525878073631997.2719124558191; Wed, 9 May 2018 08:01:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7823B80489; Wed, 9 May 2018 15:01:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 211672015883; Wed, 9 May 2018 15:01:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A77854CAAB; Wed, 9 May 2018 15:01:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49ExmVL005077 for ; Wed, 9 May 2018 10:59:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7BA0A2022DE2; Wed, 9 May 2018 14:59:48 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.34.245.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id C305B2022DE3 for ; Wed, 9 May 2018 14:59:47 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Wed, 9 May 2018 16:59:38 +0200 Message-Id: <20180509145938.18750-14-kkoukiou@redhat.com> In-Reply-To: <20180509145938.18750-1-kkoukiou@redhat.com> References: <20180509145938.18750-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 13/13] Implement SecretDefineXML method for Connect Interface X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 09 May 2018 15:01:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: Pavel Hrdina --- data/org.libvirt.Connect.xml | 7 +++++++ src/connect.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index fc29165..8691762 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -223,6 +223,13 @@ + + + + + + diff --git a/src/connect.c b/src/connect.c index 3ef068f..05381de 100644 --- a/src/connect.c +++ b/src/connect.c @@ -1151,6 +1151,35 @@ virtDBusConnectNodeSetMemoryParameters(GVariant *inA= rgs, } } =20 +static void +virtDBusConnectSecretDefineXML(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virSecret) secret =3D NULL; + g_autofree gchar *path =3D NULL; + const gchar *xml; + guint flags; + + g_variant_get(inArgs, "(&su)", &xml, &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + secret =3D virSecretDefineXML(connect->connection, xml, flags); + if (!secret) + return virtDBusUtilSetLastVirtError(error); + + path =3D virtDBusUtilBusPathForVirSecret(secret, connect->secretPath); + + *outArgs =3D g_variant_new("(o)", path); +} + static void virtDBusConnectSecretLookupByUUID(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1307,6 +1336,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethod= Table[] =3D { { "NodeGetMemoryStats", virtDBusConnectNodeGetMemoryStats }, { "NodeGetSecurityModel", virtDBusConnectNodeGetSecurityModel }, { "NodeSetMemoryParameters", virtDBusConnectNodeSetMemoryParameters }, + { "SecretDefineXML", virtDBusConnectSecretDefineXML }, { "SecretLookupByUUID", virtDBusConnectSecretLookupByUUID }, { "SecretLookupByUsage", virtDBusConnectSecretLookupByUsage }, { "StoragePoolLookupByName", virtDBusConnectStoragePoolLookupByName }, --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list