Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 7 +++++++ src/domain.c | 27 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index a6edfec..a16a13f 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -312,6 +312,13 @@ <arg name="memory" type="t" direction="in"/> <arg name="flags" type="u" direction="in"/> </method> + <method name="SetUserPassword"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetUserPassword"/> + <arg name="user" type="s" direction="in"/> + <arg name="password" type="s" direction="in"/> + <arg name="flags" type="u" direction="in"/> + </method> <method name="SetVcpus"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetVcpusFlags"/> diff --git a/src/domain.c b/src/domain.c index e4146fe..e7ef054 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1487,6 +1487,32 @@ virtDBusDomainSetMemory(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } +static void +virtDBusDomainSetUserPassword(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(virDomain) domain = NULL; + const gchar *user; + const gchar *password; + guint flags; + + g_variant_get(inArgs, "(&s&su)", &user, &password, &flags); + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainSetUserPassword(domain, user, password, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusDomainSetVcpus(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1661,6 +1687,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "SendProcessSignal", virtDBusDomainSendProcessSignal }, { "SetVcpus", virtDBusDomainSetVcpus }, { "SetMemory", virtDBusDomainSetMemory }, + { "SetUserPassword", virtDBusDomainSetUserPassword }, { "Shutdown", virtDBusDomainShutdown }, { "Suspend", virtDBusDomainSuspend }, { "Undefine", virtDBusDomainUndefine }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list