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

383d26
From cf93ce54ee801dca9d9da7dd10557b8772418520 Mon Sep 17 00:00:00 2001
383d26
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
383d26
Date: Thu, 22 Nov 2018 18:34:50 +0100
383d26
Subject: [PATCH 01/34] vnc: call sasl_server_init() only when required
383d26
MIME-Version: 1.0
383d26
Content-Type: text/plain; charset=UTF-8
383d26
Content-Transfer-Encoding: 8bit
383d26
383d26
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
383d26
Message-id: <20181122183450.719-2-marcandre.lureau@redhat.com>
383d26
Patchwork-id: 83099
383d26
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 1/1] vnc: call sasl_server_init() only when required
383d26
Bugzilla: 1614302
383d26
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
383d26
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
383d26
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
383d26
383d26
VNC server is calling sasl_server_init() during startup of QEMU, even
383d26
if SASL auth has not been enabled.
383d26
383d26
This may create undesirable warnings like "Could not find keytab file:
383d26
/etc/qemu/krb5.tab" when the user didn't configure SASL on host and
383d26
started VNC server.
383d26
383d26
Instead, only initialize SASL when needed. Note that HMP/QMP "change
383d26
vnc" calls vnc_display_open() again, which will initialize SASL if
383d26
needed.
383d26
383d26
Fix assignment in if condition, while touching this code.
383d26
383d26
Related to:
383d26
https://bugzilla.redhat.com/show_bug.cgi?id=1609327
383d26
383d26
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
383d26
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
383d26
Message-id: 20180907063634.359-1-marcandre.lureau@redhat.com
383d26
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
383d26
383d26
(cherry picked from commit b5dc0d7d565048fcf2767060261d8385805aced1)
383d26
383d26
[ Fix minor confict due to "qemu" vs "qemu-kvm" string difference ]
383d26
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
383d26
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 ui/vnc.c | 15 ++++++++-------
383d26
 1 file changed, 8 insertions(+), 7 deletions(-)
383d26
383d26
diff --git a/ui/vnc.c b/ui/vnc.c
383d26
index 0c3011b..86c6762 100644
383d26
--- a/ui/vnc.c
383d26
+++ b/ui/vnc.c
383d26
@@ -3869,9 +3869,6 @@ void vnc_display_open(const char *id, Error **errp)
383d26
     bool reverse = false;
383d26
     const char *credid;
383d26
     bool sasl = false;
383d26
-#ifdef CONFIG_VNC_SASL
383d26
-    int saslErr;
383d26
-#endif
383d26
     int acl = 0;
383d26
     int lock_key_sync = 1;
383d26
     int key_delay_ms;
383d26
@@ -4045,10 +4042,14 @@ void vnc_display_open(const char *id, Error **errp)
383d26
     trace_vnc_auth_init(vd, 1, vd->ws_auth, vd->ws_subauth);
383d26
 
383d26
 #ifdef CONFIG_VNC_SASL
383d26
-    if ((saslErr = sasl_server_init(NULL, "qemu-kvm")) != SASL_OK) {
383d26
-        error_setg(errp, "Failed to initialize SASL auth: %s",
383d26
-                   sasl_errstring(saslErr, NULL, NULL));
383d26
-        goto fail;
383d26
+    if (sasl) {
383d26
+        int saslErr = sasl_server_init(NULL, "qemu-kvm");
383d26
+
383d26
+        if (saslErr != SASL_OK) {
383d26
+            error_setg(errp, "Failed to initialize SASL auth: %s",
383d26
+                       sasl_errstring(saslErr, NULL, NULL));
383d26
+            goto fail;
383d26
+        }
383d26
     }
383d26
 #endif
383d26
     vd->lock_key_sync = lock_key_sync;
383d26
-- 
383d26
1.8.3.1
383d26