mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 23:07:18 +00:00
[client] main: if spice is in use check the guest uuid matches
If the guest supports sending us it's UUID and PureSpice has also reported the guest's UUID, check them to see if the user has accidentially connected to the wrong spice socket.
This commit is contained in:
parent
5bb1f01dea
commit
7bcd0dd97f
@ -837,10 +837,43 @@ static void audioData(uint8_t * data, size_t size)
|
|||||||
g_state.audioDev->play(data, size);
|
g_state.audioDev->play(data, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void checkUUID(void)
|
||||||
|
{
|
||||||
|
if (!g_state.spiceUUIDValid || !g_state.guestUUIDValid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (memcmp(g_state.spiceUUID, g_state.guestUUID,
|
||||||
|
sizeof(g_state.spiceUUID)) != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DEBUG_ERROR("UUIDs do not match, you have connected SPICE to the wrong guest");
|
||||||
|
DEBUG_ERROR("Shutting down");
|
||||||
|
g_state.state = APP_STATE_SHUTDOWN;
|
||||||
|
}
|
||||||
|
|
||||||
void spiceReady(void)
|
void spiceReady(void)
|
||||||
{
|
{
|
||||||
// set the intial mouse mode
|
// set the intial mouse mode
|
||||||
purespice_mouseMode(true);
|
purespice_mouseMode(true);
|
||||||
|
|
||||||
|
PSServerInfo info;
|
||||||
|
if (!purespice_getServerInfo(&info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool uuidValid = false;
|
||||||
|
for(int i = 0; i < sizeof(info.uuid); ++i)
|
||||||
|
if (info.uuid[i])
|
||||||
|
{
|
||||||
|
uuidValid = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!uuidValid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
memcpy(g_state.spiceUUID, info.uuid, sizeof(g_state.spiceUUID));
|
||||||
|
g_state.spiceUUIDValid = true;
|
||||||
|
checkUUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
int spiceThread(void * arg)
|
int spiceThread(void * arg)
|
||||||
@ -1313,19 +1346,20 @@ restart:
|
|||||||
vmInfo->cores, vmInfo->cpus);
|
vmInfo->cores, vmInfo->cpus);
|
||||||
DEBUG_INFO("Capture Device : %s", vmInfo->capture);
|
DEBUG_INFO("Capture Device : %s", vmInfo->capture);
|
||||||
|
|
||||||
bool checkUUID = false;
|
bool uuidValid = false;
|
||||||
for(int i = 0; i < 16; ++i)
|
for(int i = 0; i < sizeof(vmInfo->uuid); ++i)
|
||||||
if (vmInfo->uuid[i])
|
if (vmInfo->uuid[i])
|
||||||
{
|
{
|
||||||
checkUUID = true;
|
uuidValid = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!checkUUID)
|
if (!uuidValid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//TODO: compare UUID with the one provided by SPICE if SPICE is in use
|
memcpy(g_state.guestUUID, vmInfo->uuid, sizeof(g_state.guestUUID));
|
||||||
|
g_state.guestUUIDValid = true;
|
||||||
|
checkUUID();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,11 @@ struct AppState
|
|||||||
bool dsInitialized;
|
bool dsInitialized;
|
||||||
bool jitRender;
|
bool jitRender;
|
||||||
|
|
||||||
|
uint8_t spiceUUID[16];
|
||||||
|
bool spiceUUIDValid;
|
||||||
|
uint8_t guestUUID[16];
|
||||||
|
bool guestUUIDValid;
|
||||||
|
|
||||||
bool stopVideo;
|
bool stopVideo;
|
||||||
bool ignoreInput;
|
bool ignoreInput;
|
||||||
bool escapeActive;
|
bool escapeActive;
|
||||||
|
Loading…
Reference in New Issue
Block a user