diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-07-18 16:46:44 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-07-19 14:41:39 +0400 |
commit | 36f501ef7567c390b9c25cc6c3e59ab37e051942 (patch) | |
tree | 1047b3e1a650270b07ace9c0edaff4dcda8cb5fc | |
parent | 3153ce81f8f1c9fd5cd703d9f1d936fdc42678a4 (diff) |
Generate a random connection ID with g_random_int()
Spice uses rand() to generate the random id, but qemu (at least in the case
of qemu-system-x86) fails to initialize the RNG seed (with e.g. srand()).
The result is, that every SPICE session started (by e.g. libvirtd) has the
same client_id. Usually, this is not a problem, but running something like
a SPICE proxy, relying on the client_id to correctly route connections,
this creates problems.
Fixes:
https://gitlab.com/qemu-project/qemu/-/issues/163
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r-- | server/reds.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/server/reds.cpp b/server/reds.cpp index 06702371..49113316 100644 --- a/server/reds.cpp +++ b/server/reds.cpp @@ -1781,7 +1781,7 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link) if (link_mess->connection_id == 0) { reds_send_link_result(link, SPICE_LINK_ERR_OK); - while((connection_id = rand()) == 0); + while((connection_id = g_random_int()) == 0); mig_target = FALSE; } else { // TODO: make sure link_mess->connection_id is the same |