qapi: Introduce change-vnc-password
authorLuiz Capitulino <lcapitulino@redhat.com>
Thu, 8 Dec 2011 13:45:55 +0000 (11:45 -0200)
committerLuiz Capitulino <lcapitulino@redhat.com>
Wed, 18 Jan 2012 12:23:39 +0000 (10:23 -0200)
New QMP command to change the VNC password.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qapi-schema.json
qmp-commands.hx
qmp.c

index 42682eb2e2043a00c8d34382eef4f3fe2fdb4df3..fe935a9d7e7ac800b1fd53b87e65b15fb52f5342 100644 (file)
 # Since: 0.14.0
 ##
 { 'command': 'eject', 'data': {'device': 'str', '*force': 'bool'} }
+
+##
+# @change-vnc-password:
+#
+# Change the VNC server password.
+#
+# @target:  the new password to use with VNC authentication
+#
+# Since: 1.1
+#
+# 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'} }
index 185bebabee231eea2f3f6d7878d88cea7f816891..886d589fd57a678faf21336def60be93636062c1 100644 (file)
@@ -2018,3 +2018,9 @@ EQMP
        .args_type  = "path:s,property:s",
        .mhandler.cmd_new = qmp_qom_get,
     },
+
+    {
+        .name       = "change-vnc-password",
+        .args_type  = "password:s",
+        .mhandler.cmd_new = qmp_marshal_input_change_vnc_password,
+    },
diff --git a/qmp.c b/qmp.c
index 8b7b37999dda5b05b429b386242ad3a87f0ece59..f218485ef18c428e62e0c2eb0cb017407ae2205a 100644 (file)
--- a/qmp.c
+++ b/qmp.c
@@ -343,3 +343,10 @@ void qmp_expire_password(const char *protocol, const char *whenstr,
 
     error_set(errp, QERR_INVALID_PARAMETER, "protocol");
 }
+
+void qmp_change_vnc_password(const char *password, Error **errp)
+{
+    if (vnc_display_password(NULL, password) < 0) {
+        error_set(errp, QERR_SET_PASSWD_FAILED);
+    }
+}