From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Gerd Hoffmann 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> Subject: [Qemu-devel] [PATCH 03/10] vnc: add display id to acl names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Markus Armbruster , Anthony Liguori , Gerd Hoffmann 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 -- 1.8.3.1