From patchwork Wed Jul 2 10:59:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 366322 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 545B11400D5 for ; Wed, 2 Jul 2014 21:14:13 +1000 (EST) Received: from localhost ([::1]:52431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2IUN-0003Pj-88 for incoming@patchwork.ozlabs.org; Wed, 02 Jul 2014 07:14:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2ITr-0002iP-6U for qemu-devel@nongnu.org; Wed, 02 Jul 2014 07:13:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2ITj-0005hN-OP for qemu-devel@nongnu.org; Wed, 02 Jul 2014 07:13:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2ITj-0005hA-Gl for qemu-devel@nongnu.org; Wed, 02 Jul 2014 07:13:31 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s62BDT8E027914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Jul 2014 07:13:29 -0400 Received: from nilsson.home.kraxel.org (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s62BDSrI019681; Wed, 2 Jul 2014 07:13:28 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 938B2809BD; Wed, 2 Jul 2014 13:13:26 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 2 Jul 2014 12:59:56 +0200 Message-Id: <1404298796-30635-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann , Anthony Liguori Subject: [Qemu-devel] [PATCH] spice: auth fixes 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 Set auth to sasl when sasl is enabled, this makes "info spice" correctly display sasl auth. Also throw an error in case someone tries to set a spice password via monitor without auth mode being "spice". Signed-off-by: Gerd Hoffmann --- ui/spice-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/spice-core.c b/ui/spice-core.c index 70df446..7bb91e6 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -741,6 +741,7 @@ void qemu_spice_init(void) error_report("spice: failed to enable sasl"); exit(1); } + auth = "sasl"; } if (qemu_opt_get_bool(opts, "disable-ticketing", 0)) { auth = "none"; @@ -894,6 +895,10 @@ static int qemu_spice_set_ticket(bool fail_if_conn, bool disconnect_if_conn) int qemu_spice_set_passwd(const char *passwd, bool fail_if_conn, bool disconnect_if_conn) { + if (strcmp(auth, "spice") != 0) { + return -1; + } + g_free(auth_passwd); auth_passwd = g_strdup(passwd); return qemu_spice_set_ticket(fail_if_conn, disconnect_if_conn);