diff options
Diffstat (limited to 'kvmd/apps/vnc/rfb/__init__.py')
-rw-r--r-- | kvmd/apps/vnc/rfb/__init__.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kvmd/apps/vnc/rfb/__init__.py b/kvmd/apps/vnc/rfb/__init__.py index d6cdf6d8..847325a5 100644 --- a/kvmd/apps/vnc/rfb/__init__.py +++ b/kvmd/apps/vnc/rfb/__init__.py @@ -261,11 +261,15 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute await self._write_reason("refusing security type reason", msg) raise RfbError(msg) - await self._write_struct("security types", "B" + "B" * len(sec_types), len(sec_types), *sec_types) # Keep dict priority + if self.__rfb_version > 3: + await self._write_struct("security types", "B" + "B" * len(sec_types), len(sec_types), *sec_types) # Keep dict priority - sec_type = await self._read_number("selected security type", "B") - if sec_type not in sec_types: - raise RfbError(f"Invalid security type: {sec_type}") + sec_type = await self._read_number("selected security type", "B") + if sec_type not in sec_types: + raise RfbError(f"Invalid security type: {sec_type}") + else: + sec_type = min(sec_types.keys()) + await self._write_struct("selected security type", "L", sec_type) (sec_name, handler) = sec_types[sec_type] get_logger(0).info("%s [main]: Using %s security type", self._remote, sec_name) |