From patchwork Mon Jan 9 11:24:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 134999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2433FB6F71 for ; Mon, 9 Jan 2012 22:26:02 +1100 (EST) Received: from localhost ([::1]:39179 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkDMH-0002x3-6a for incoming@patchwork.ozlabs.org; Mon, 09 Jan 2012 06:25:45 -0500 Received: from eggs.gnu.org ([140.186.70.92]:52656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkDLH-0000vY-LI for qemu-devel@nongnu.org; Mon, 09 Jan 2012 06:24:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkDLC-0006hB-J9 for qemu-devel@nongnu.org; Mon, 09 Jan 2012 06:24:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18655) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkDLC-0006h5-6E for qemu-devel@nongnu.org; Mon, 09 Jan 2012 06:24:38 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q09BOZgL017135 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 9 Jan 2012 06:24:36 -0500 Received: from localhost (ovpn-113-68.phx2.redhat.com [10.3.113.68]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q09BOYBK031280; Mon, 9 Jan 2012 06:24:35 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Mon, 9 Jan 2012 09:24:14 -0200 Message-Id: <1326108257-13042-8-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1326108257-13042-1-git-send-email-lcapitulino@redhat.com> References: <1326108257-13042-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH 07/10] qapi: Introduce change-vnc-password X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org New QMP command to change the VNC password. Signed-off-by: Anthony Liguori Signed-off-by: Luiz Capitulino --- qapi-schema.json | 15 +++++++++++++++ qmp-commands.hx | 6 ++++++ qmp.c | 14 ++++++++++++++ 3 files changed, 35 insertions(+), 0 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index 42682eb..171e781 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1352,3 +1352,18 @@ # 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 won't allow users to connect until +# the password is set again. 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 185beba..886d589 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -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 7c1815b..fb94f0f 100644 --- a/qmp.c +++ b/qmp.c @@ -341,3 +341,17 @@ 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 (!password || !password[0]) { + if (vnc_display_disable_login(NULL) < 0) { + error_set(errp, QERR_SET_PASSWD_FAILED); + } + return; + } + + if (vnc_display_password(NULL, password) < 0) { + error_set(errp, QERR_SET_PASSWD_FAILED); + } +}