diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-09-07 10:36:34 +0400 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2018-10-01 11:29:03 +0200 |
commit | b5dc0d7d565048fcf2767060261d8385805aced1 (patch) | |
tree | 93042f7285976715a5b34ee1834eb517bf6fd0a7 /ui | |
parent | 6624c38d11d0bdb45579c3cc8c7499af79b20564 (diff) | |
download | qemu-b5dc0d7d565048fcf2767060261d8385805aced1.zip qemu-b5dc0d7d565048fcf2767060261d8385805aced1.tar.gz qemu-b5dc0d7d565048fcf2767060261d8385805aced1.tar.bz2 |
vnc: call sasl_server_init() only when required
VNC server is calling sasl_server_init() during startup of QEMU, even
if SASL auth has not been enabled.
This may create undesirable warnings like "Could not find keytab file:
/etc/qemu/krb5.tab" when the user didn't configure SASL on host and
started VNC server.
Instead, only initialize SASL when needed. Note that HMP/QMP "change
vnc" calls vnc_display_open() again, which will initialize SASL if
needed.
Fix assignment in if condition, while touching this code.
Related to:
https://bugzilla.redhat.com/show_bug.cgi?id=1609327
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20180907063634.359-1-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/vnc.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -3821,9 +3821,6 @@ void vnc_display_open(const char *id, Error **errp) bool reverse = false; const char *credid; bool sasl = false; -#ifdef CONFIG_VNC_SASL - int saslErr; -#endif int acl = 0; int lock_key_sync = 1; int key_delay_ms; @@ -3963,10 +3960,14 @@ void vnc_display_open(const char *id, Error **errp) trace_vnc_auth_init(vd, 1, vd->ws_auth, vd->ws_subauth); #ifdef CONFIG_VNC_SASL - if ((saslErr = sasl_server_init(NULL, "qemu")) != SASL_OK) { - error_setg(errp, "Failed to initialize SASL auth: %s", - sasl_errstring(saslErr, NULL, NULL)); - goto fail; + if (sasl) { + int saslErr = sasl_server_init(NULL, "qemu"); + + if (saslErr != SASL_OK) { + error_setg(errp, "Failed to initialize SASL auth: %s", + sasl_errstring(saslErr, NULL, NULL)); + goto fail; + } } #endif vd->lock_key_sync = lock_key_sync; |