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

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