]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
ui/vnc: don't return an empty SASL mechlist to the client
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 11 Sep 2024 12:08:24 +0000 (13:08 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 22 Oct 2024 10:44:23 +0000 (11:44 +0100)
The SASL initialization phase may determine that there are no valid
mechanisms available to use. This may be because the host OS admin
forgot to install some packages, or it might be because the requested
SSF level is incompatible with available mechanisms, or other unknown
reasons.

If we return an empty mechlist to the client, they're going to get a
failure from the SASL library on their end and drop the connection.
Thus there is no point even sending this back to the client, we can
just drop the connection immediately.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
ui/vnc-auth-sasl.c

index 47fdae5b215b93b7ea3c9c52ce7bdeee051e9dfc..7d9ca9e8ac7a1d11fb9fd540fb2cb81230ddd9b0 100644 (file)
@@ -674,6 +674,13 @@ void start_auth_sasl(VncState *vs)
     }
     trace_vnc_auth_sasl_mech_list(vs, mechlist);
 
+    if (g_str_equal(mechlist, "")) {
+        trace_vnc_auth_fail(vs, vs->auth, "no available SASL mechanisms", "");
+        sasl_dispose(&vs->sasl.conn);
+        vs->sasl.conn = NULL;
+        goto authabort;
+    }
+
     vs->sasl.mechlist = g_strdup(mechlist);
     mechlistlen = strlen(mechlist);
     vnc_write_u32(vs, mechlistlen);