aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/vnc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/ui/vnc.c b/ui/vnc.c
index 916a16d312..cf221c83cc 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -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;