From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1tUI-0002Zq-GZ for qemu-devel@nongnu.org; Fri, 19 Dec 2014 04:04:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y1tUA-0000Rx-Hh for qemu-devel@nongnu.org; Fri, 19 Dec 2014 04:04:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1tUA-0000QT-9Q for qemu-devel@nongnu.org; Fri, 19 Dec 2014 04:04:34 -0500 From: Gerd Hoffmann Date: Fri, 19 Dec 2014 10:04:19 +0100 Message-Id: <1418979866-1615-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1418979866-1615-1-git-send-email-kraxel@redhat.com> References: <1418979866-1615-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 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: Gerd Hoffmann , Anthony Liguori 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