+#
+# Since: 1.0
+#
+# Notes: An empty password in this command will set the password to the empty
+# string. Existing clients are unaffected by executing this command.
+##
+{ 'command': 'change-vnc-password', 'data': {'password': 'str'} }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 909c778..d60f72f 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -868,6 +868,14 @@ Example:
EQMP
{
+ .name = "change-vnc-password",
+ .args_type = "password:s",
+ .params = "password",
+ .help = "set vnc password",
+ .mhandler.cmd_new = qmp_marshal_input_change_vnc_password,
+ },
+
+ {
.name = "set_password",
.args_type = "protocol:s,password:s,connected:s?",
.params = "protocol password action-if-connected",
diff --git a/qmp.c b/qmp.c
index 8aa9c66..f817a88 100644
--- a/qmp.c
+++ b/qmp.c
@@ -12,9 +12,11 @@
*/
#include "qemu-common.h"
-#include "sysemu.h"
#include "qmp-commands.h"
+#include "sysemu.h"
+#include "console.h"
+
NameInfo *qmp_query_name(Error **errp)
{
NameInfo *info = g_malloc0(sizeof(*info));
@@ -26,3 +28,10 @@ NameInfo *qmp_query_name(Error **errp)
return info;
}
+
+void qmp_change_vnc_password(const char *password, Error **err)
+{
+ if (vnc_display_password(NULL, password)< 0) {
+ error_set(err, QERR_SET_PASSWD_FAILED);
+ }
+}