From patchwork Mon Jan 12 12:53:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 427737 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 832EB1401DA for ; Mon, 12 Jan 2015 23:57:01 +1100 (AEDT) Received: from localhost ([::1]:33873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAeYF-00025J-P5 for incoming@patchwork.ozlabs.org; Mon, 12 Jan 2015 07:56:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAeVU-0005Za-G6 for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:54:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YAeVO-0001SZ-To for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:54:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40099) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAeVO-0001SK-Lj for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:54:02 -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 t0CCs0X6000971 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Jan 2015 07:54:00 -0500 Received: from nilsson.home.kraxel.org (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0CCrxI6024026; Mon, 12 Jan 2015 07:54:00 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 5B8D781D9F; Mon, 12 Jan 2015 13:53:59 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Jan 2015 13:53:50 +0100 Message-Id: <1421067237-6955-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1421067237-6955-1-git-send-email-kraxel@redhat.com> References: <1421067237-6955-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Markus Armbruster , Anthony Liguori , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 03/10] vnc: add display id to acl names 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 In case the display id is "default" (which is the one you get if you don't explicitly assign one) we keep the old name scheme, without display, for backward compatibility reasons. Signed-off-by: Gerd Hoffmann Reviewed-by: Gonglei --- ui/vnc.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index fce4861..1b86365 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3206,18 +3206,36 @@ void vnc_display_open(const char *id, const char *display, Error **errp) #ifdef CONFIG_VNC_TLS if (acl && x509 && vs->tls.x509verify) { - if (!(vs->tls.acl = qemu_acl_init("vnc.x509dname"))) { + char *aclname; + + if (strcmp(vs->id, "default") == 0) { + aclname = g_strdup("vnc.x509dname"); + } else { + aclname = g_strdup_printf("vnc.%s.x509dname", vs->id); + } + vs->tls.acl = qemu_acl_init(aclname); + if (!vs->tls.acl) { fprintf(stderr, "Failed to create x509 dname ACL\n"); exit(1); } + g_free(aclname); } #endif #ifdef CONFIG_VNC_SASL if (acl && sasl) { - if (!(vs->sasl.acl = qemu_acl_init("vnc.username"))) { + char *aclname; + + if (strcmp(vs->id, "default") == 0) { + aclname = g_strdup("vnc.username"); + } else { + aclname = g_strdup_printf("vnc.%s.username", vs->id); + } + vs->sasl.acl = qemu_acl_init(aclname); + if (!vs->sasl.acl) { fprintf(stderr, "Failed to create username ACL\n"); exit(1); } + g_free(aclname); } #endif