diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2024-09-11 13:08:24 +0100 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2024-10-22 11:44:23 +0100 |
commit | 46c80446b5c1caf39a7ed2d0e426c4712f8e98d2 (patch) | |
tree | 49d4e1cc2efc47acca4b5876987f781ed4f4555c /ui | |
parent | f8395ce8a349245c5b7e4645e34350366b0c734b (diff) | |
download | qemu-46c80446b5c1caf39a7ed2d0e426c4712f8e98d2.zip qemu-46c80446b5c1caf39a7ed2d0e426c4712f8e98d2.tar.gz qemu-46c80446b5c1caf39a7ed2d0e426c4712f8e98d2.tar.bz2 |
ui/vnc: don't return an empty SASL mechlist to the client
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>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/vnc-auth-sasl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index 47fdae5..7d9ca9e 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -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); |