mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(instances): a VNC password the browser console can send, kept as set
The console settings accepted any password of at most 8 bytes, so "éééé" was saved, but noVNC derives its key from the characters while QEMU compares the UTF-8 bytes: the browser console could not log in. A new password now takes up to 8 printable ASCII characters, which also keeps control characters out of the definition. The .vv file wrote the password and the VM name as they are; virt-viewer reads it as a GLib key file, so a backslash or a leading space changed the password. Both are escaped as a key file expects. A new or removed password also drops a passwdValidTo set elsewhere: an expired one left the new password unusable.
This commit is contained in:
parent
275bf11aed
commit
cd3edf4dff
11 changed files with 257 additions and 222 deletions
|
|
@ -53,7 +53,7 @@ class UpdateConsoleTestCase(TestCase):
|
|||
proxy.set_console_keymap.assert_not_called()
|
||||
|
||||
def test_the_password_changes_by_the_action_chosen(self):
|
||||
for action, password in (("set", " a b c "), ("set", "éééé"), ("none", "")):
|
||||
for action, password in (("set", " a b c "), ("set", "~a\\b{}!"), ("none", "")):
|
||||
with self.subTest(action, password=password):
|
||||
proxy, _ = self.post({**VNC, "password_action": action, "password": password})
|
||||
proxy.set_console_passwd.assert_called_once_with(password)
|
||||
|
|
@ -62,7 +62,8 @@ class UpdateConsoleTestCase(TestCase):
|
|||
self.assertEqual(len(generated), 8)
|
||||
|
||||
def test_a_password_vnc_cannot_take_is_refused_and_nothing_is_saved(self):
|
||||
for password in ("", "123456789", "ééééé"): # libvirt counts bytes: é is two
|
||||
# the browser console sends the password's characters, QEMU expects its bytes
|
||||
for password in ("", "123456789", "éé", "a\nb", "a\tb"):
|
||||
with self.subTest(password=password):
|
||||
proxy, messages = self.post({**VNC, "keymap": "de", "password_action": "set", "password": password})
|
||||
proxy.set_console_passwd.assert_not_called()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue