From nobody Thu Nov 6 01:19:38 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538391167143718.9099190260944; Mon, 1 Oct 2018 03:52:47 -0700 (PDT) Received: from localhost ([::1]:37296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6voi-0005q0-0G for importer@patchew.org; Mon, 01 Oct 2018 06:52:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6vex-0006AM-S6 for qemu-devel@nongnu.org; Mon, 01 Oct 2018 06:42:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6vew-0000j2-SC for qemu-devel@nongnu.org; Mon, 01 Oct 2018 06:42:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44242) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g6vew-0000is-Io for qemu-devel@nongnu.org; Mon, 01 Oct 2018 06:42:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC18E81DF1 for ; Mon, 1 Oct 2018 10:42:37 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97B947B523; Mon, 1 Oct 2018 10:42:31 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 8AD8C9D374; Mon, 1 Oct 2018 12:42:30 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 1 Oct 2018 12:42:29 +0200 Message-Id: <20181001104230.17779-3-kraxel@redhat.com> In-Reply-To: <20181001104230.17779-1-kraxel@redhat.com> References: <20181001104230.17779-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 01 Oct 2018 10:42:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/3] vnc: call sasl_server_init() only when required X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau VNC server is calling sasl_server_init() during startup of QEMU, even if SASL auth has not been enabled. This may create undesirable warnings like "Could not find keytab file: /etc/qemu/krb5.tab" when the user didn't configure SASL on host and started VNC server. Instead, only initialize SASL when needed. Note that HMP/QMP "change vnc" calls vnc_display_open() again, which will initialize SASL if needed. Fix assignment in if condition, while touching this code. Related to: https://bugzilla.redhat.com/show_bug.cgi?id=3D1609327 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20180907063634.359-1-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 916a16d312..cf221c83cc 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3821,9 +3821,6 @@ void vnc_display_open(const char *id, Error **errp) bool reverse =3D false; const char *credid; bool sasl =3D false; -#ifdef CONFIG_VNC_SASL - int saslErr; -#endif int acl =3D 0; int lock_key_sync =3D 1; int key_delay_ms; @@ -3963,10 +3960,14 @@ void vnc_display_open(const char *id, Error **errp) trace_vnc_auth_init(vd, 1, vd->ws_auth, vd->ws_subauth); =20 #ifdef CONFIG_VNC_SASL - if ((saslErr =3D sasl_server_init(NULL, "qemu")) !=3D SASL_OK) { - error_setg(errp, "Failed to initialize SASL auth: %s", - sasl_errstring(saslErr, NULL, NULL)); - goto fail; + if (sasl) { + int saslErr =3D sasl_server_init(NULL, "qemu"); + + if (saslErr !=3D SASL_OK) { + error_setg(errp, "Failed to initialize SASL auth: %s", + sasl_errstring(saslErr, NULL, NULL)); + goto fail; + } } #endif vd->lock_key_sync =3D lock_key_sync; --=20 2.9.3