[libvirt] [dbus PATCH 12/13] Implement SetValue method for Secret Interface

Pavel Hrdina phrdina at redhat.com
Thu May 10 11:33:39 UTC 2018


On Wed, May 09, 2018 at 04:59:37PM +0200, Katerina Koukiou wrote:
> Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
> ---
>  data/org.libvirt.Secret.xml |  6 ++++++
>  src/secret.c                | 34 ++++++++++++++++++++++++++++++++++
>  2 files changed, 40 insertions(+)

[...]

> 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 = g_variant_new("(s)", xml);
>  }
>  
> +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 = userData;
> +    g_autoptr(virSecret) secret = NULL;
> +    g_autoptr(GVariantIter) iter = NULL;
> +    guint flags;
> +    g_autofree guchar *value = NULL;
> +    guchar *tmp;
> +    gsize size;
> +
> +    g_variant_get(inArgs, "(ayu)", &iter, &flags);
> +
> +    secret = virtDBusSecretGetVirSecret(connect, objectPath, error);
> +    if (!secret)
> +        return;
> +
> +    size = g_variant_iter_n_children(iter);
> +    value = g_new0(guchar, size);
> +    tmp = value;
> +    while (g_variant_iter_next(iter, "y", tmp))
> +        tmp++;

Swap these two block, parse the array before getting secret object.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180510/a781ecdd/attachment-0001.sig>


More information about the libvir-list mailing list