yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-vnc-call-sasl_server_init-only-when-required.patch

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