thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
ae23c9
From 7bc411803771ae9c18290eeb55480bab5cd66b93 Mon Sep 17 00:00:00 2001
ae23c9
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
ae23c9
Date: Tue, 2 Oct 2018 12:34:03 +0100
ae23c9
Subject: [PATCH 01/49] vnc: call sasl_server_init() only when required
ae23c9
MIME-Version: 1.0
ae23c9
Content-Type: text/plain; charset=UTF-8
ae23c9
Content-Transfer-Encoding: 8bit
ae23c9
ae23c9
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
Message-id: <20181002123403.20747-2-marcandre.lureau@redhat.com>
ae23c9
Patchwork-id: 82356
ae23c9
O-Subject: [RHEL8/rhel qemu-kvm PATCH 1/1] vnc: call sasl_server_init() only when required
ae23c9
Bugzilla: 1609327
ae23c9
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
ae23c9
ae23c9
VNC server is calling sasl_server_init() during startup of QEMU, even
ae23c9
if SASL auth has not been enabled.
ae23c9
ae23c9
This may create undesirable warnings like "Could not find keytab file:
ae23c9
/etc/qemu/krb5.tab" when the user didn't configure SASL on host and
ae23c9
started VNC server.
ae23c9
ae23c9
Instead, only initialize SASL when needed. Note that HMP/QMP "change
ae23c9
vnc" calls vnc_display_open() again, which will initialize SASL if
ae23c9
needed.
ae23c9
ae23c9
Fix assignment in if condition, while touching this code.
ae23c9
ae23c9
Related to:
ae23c9
https://bugzilla.redhat.com/show_bug.cgi?id=1609327
ae23c9
ae23c9
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
ae23c9
Message-id: 20180907063634.359-1-marcandre.lureau@redhat.com
ae23c9
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ae23c9
ae23c9
(cherry picked from commit b5dc0d7d565048fcf2767060261d8385805aced1)
ae23c9
ae23c9
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1609327
ae23c9
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=18601393
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
ae23c9
Conflicts:
ae23c9
        ui/vnc.c
ae23c9
        Due to "qemu"->"qemu-kvm" rename.
ae23c9
ae23c9
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
---
ae23c9
 ui/vnc.c | 15 ++++++++-------
ae23c9
 1 file changed, 8 insertions(+), 7 deletions(-)
ae23c9
ae23c9
diff --git a/ui/vnc.c b/ui/vnc.c
ae23c9
index 0c3011b..86c6762 100644
ae23c9
--- a/ui/vnc.c
ae23c9
+++ b/ui/vnc.c
ae23c9
@@ -3869,9 +3869,6 @@ void vnc_display_open(const char *id, Error **errp)
ae23c9
     bool reverse = false;
ae23c9
     const char *credid;
ae23c9
     bool sasl = false;
ae23c9
-#ifdef CONFIG_VNC_SASL
ae23c9
-    int saslErr;
ae23c9
-#endif
ae23c9
     int acl = 0;
ae23c9
     int lock_key_sync = 1;
ae23c9
     int key_delay_ms;
ae23c9
@@ -4045,10 +4042,14 @@ void vnc_display_open(const char *id, Error **errp)
ae23c9
     trace_vnc_auth_init(vd, 1, vd->ws_auth, vd->ws_subauth);
ae23c9
 
ae23c9
 #ifdef CONFIG_VNC_SASL
ae23c9
-    if ((saslErr = sasl_server_init(NULL, "qemu-kvm")) != SASL_OK) {
ae23c9
-        error_setg(errp, "Failed to initialize SASL auth: %s",
ae23c9
-                   sasl_errstring(saslErr, NULL, NULL));
ae23c9
-        goto fail;
ae23c9
+    if (sasl) {
ae23c9
+        int saslErr = sasl_server_init(NULL, "qemu-kvm");
ae23c9
+
ae23c9
+        if (saslErr != SASL_OK) {
ae23c9
+            error_setg(errp, "Failed to initialize SASL auth: %s",
ae23c9
+                       sasl_errstring(saslErr, NULL, NULL));
ae23c9
+            goto fail;
ae23c9
+        }
ae23c9
     }
ae23c9
 #endif
ae23c9
     vd->lock_key_sync = lock_key_sync;
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9