* [Qemu-devel] [PULL 0/3] vnc patch queue @ 2014-06-02 14:33 Gerd Hoffmann 2014-06-02 14:33 ` [Qemu-devel] [PULL 1/3] vnc: refuse to set a password with VNC_AUTH_NONE Gerd Hoffmann ` (3 more replies) 0 siblings, 4 replies; 7+ messages in thread From: Gerd Hoffmann @ 2014-06-02 14:33 UTC (permalink / raw) To: qemu-devel; +Cc: Gerd Hoffmann Hi, Carrying three little patches. please pull, Gerd The following changes since commit 9bb931802e6ab5ab6947e3cb9cea934fc0724274: Revert "bsd-user: replace fprintf(stderr, ...) with error_report()" (2014-06-02 13:26:59 +0100) are available in the git repository at: git://git.kraxel.org/qemu tags/pull-vnc-3 for you to fetch changes up to b52991537c0efe27ee0c1955eb28a4584226d8b5: vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16,24,32} (2014-06-02 16:30:52 +0200) ---------------------------------------------------------------- misc minor vnc patches ---------------------------------------------------------------- Gerd Hoffmann (2): vnc: refuse to set a password with VNC_AUTH_NONE vnc: add trace events for key events Gonglei (1): vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16,24,32} trace-events | 8 +++++++ ui/vnc-enc-tight.c | 8 ++++++- ui/vnc.c | 61 ++++++++++++++++++++++++++---------------------------- 3 files changed, 44 insertions(+), 33 deletions(-) ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PULL 1/3] vnc: refuse to set a password with VNC_AUTH_NONE 2014-06-02 14:33 [Qemu-devel] [PULL 0/3] vnc patch queue Gerd Hoffmann @ 2014-06-02 14:33 ` Gerd Hoffmann 2014-06-02 14:33 ` [Qemu-devel] [PULL 2/3] vnc: add trace events for key events Gerd Hoffmann ` (2 subsequent siblings) 3 siblings, 0 replies; 7+ messages in thread From: Gerd Hoffmann @ 2014-06-02 14:33 UTC (permalink / raw) To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori Current code silently changes the authentication settings in case you try to set a password without password authentication turned on. This is bad. Return an error instead. If we want allow changing auth settings at runtime this should be done explicitly using a separate monitor command, not as side effect of set_passwd. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- ui/vnc.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 2d7def9..64aa2fa 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2976,26 +2976,6 @@ static void vnc_display_close(DisplayState *ds) #endif } -static int vnc_display_disable_login(DisplayState *ds) -{ - VncDisplay *vs = vnc_display; - - if (!vs) { - return -1; - } - - if (vs->password) { - g_free(vs->password); - } - - vs->password = NULL; - if (vs->auth == VNC_AUTH_NONE) { - vs->auth = VNC_AUTH_VNC; - } - - return 0; -} - int vnc_display_password(DisplayState *ds, const char *password) { VncDisplay *vs = vnc_display; @@ -3003,20 +2983,18 @@ int vnc_display_password(DisplayState *ds, const char *password) if (!vs) { return -EINVAL; } - - if (!password) { - /* This is not the intention of this interface but err on the side - of being safe */ - return vnc_display_disable_login(ds); + if (vs->auth == VNC_AUTH_NONE) { + error_printf_unless_qmp("If you want use passwords please enable " + "password auth using '-vnc ${dpy},password'."); + return -EINVAL; } if (vs->password) { g_free(vs->password); vs->password = NULL; } - vs->password = g_strdup(password); - if (vs->auth == VNC_AUTH_NONE) { - vs->auth = VNC_AUTH_VNC; + if (password) { + vs->password = g_strdup(password); } return 0; -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PULL 2/3] vnc: add trace events for key events 2014-06-02 14:33 [Qemu-devel] [PULL 0/3] vnc patch queue Gerd Hoffmann 2014-06-02 14:33 ` [Qemu-devel] [PULL 1/3] vnc: refuse to set a password with VNC_AUTH_NONE Gerd Hoffmann @ 2014-06-02 14:33 ` Gerd Hoffmann 2014-06-02 14:33 ` [Qemu-devel] [PULL 3/3] vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16, 24, 32} Gerd Hoffmann 2014-06-02 15:09 ` [Qemu-devel] [PULL 0/3] vnc patch queue Peter Maydell 3 siblings, 0 replies; 7+ messages in thread From: Gerd Hoffmann @ 2014-06-02 14:33 UTC (permalink / raw) To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- trace-events | 8 ++++++++ ui/vnc.c | 27 +++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/trace-events b/trace-events index f256ca5..616a2d6 100644 --- a/trace-events +++ b/trace-events @@ -1047,6 +1047,14 @@ gd_update(const char *tab, int x, int y, int w, int h) "tab=%s, x=%d, y=%d, w=%d gd_key_event(const char *tab, int gdk_keycode, int qemu_keycode, const char *action) "tab=%s, translated GDK keycode %d to QEMU keycode %d (%s)" gd_grab(const char *tab, const char *device, bool on) "tab=%s, %s %d" +# ui/vnc.c +vnc_key_guest_leds(bool caps, bool num, bool scroll) "caps %d, num %d, scroll %d" +vnc_key_map_init(const char *layout) "%s" +vnc_key_event_ext(bool down, int sym, int keycode, const char *name) "down %d, sym 0x%x, keycode 0x%x [%s]" +vnc_key_event_map(bool down, int sym, int keycode, const char *name) "down %d, sym 0x%x -> keycode 0x%x [%s]" +vnc_key_sync_numlock(bool on) "%d" +vnc_key_sync_capslock(bool on) "%d" + # ui/input.c input_event_key_number(int conidx, int number, const char *qcode, bool down) "con %d, key number 0x%x [%s], down %d" input_event_key_qcode(int conidx, const char *qcode, bool down) "con %d, key qcode %s, down %d" diff --git a/ui/vnc.c b/ui/vnc.c index 64aa2fa..61b1f93 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -26,6 +26,7 @@ #include "vnc.h" #include "vnc-jobs.h" +#include "trace.h" #include "sysemu/sysemu.h" #include "qemu/sockets.h" #include "qemu/timer.h" @@ -1597,6 +1598,10 @@ static void kbd_leds(void *opaque, int ledstate) int caps, num, scr; bool has_changed = (ledstate != current_led_state(vs)); + trace_vnc_key_guest_leds((ledstate & QEMU_CAPS_LOCK_LED), + (ledstate & QEMU_NUM_LOCK_LED), + (ledstate & QEMU_SCROLL_LOCK_LED)); + caps = ledstate & QEMU_CAPS_LOCK_LED ? 1 : 0; num = ledstate & QEMU_NUM_LOCK_LED ? 1 : 0; scr = ledstate & QEMU_SCROLL_LOCK_LED ? 1 : 0; @@ -1659,11 +1664,13 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) */ if (keysym_is_numlock(vs->vd->kbd_layout, sym & 0xFFFF)) { if (!vs->modifiers_state[0x45]) { + trace_vnc_key_sync_numlock(true); vs->modifiers_state[0x45] = 1; press_key(vs, 0xff7f); } } else { if (vs->modifiers_state[0x45]) { + trace_vnc_key_sync_numlock(false); vs->modifiers_state[0x45] = 0; press_key(vs, 0xff7f); } @@ -1682,11 +1689,13 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) int capslock = !!(vs->modifiers_state[0x3a]); if (capslock) { if (uppercase == shift) { + trace_vnc_key_sync_capslock(false); vs->modifiers_state[0x3a] = 0; press_key(vs, 0xffe5); } } else { if (uppercase != shift) { + trace_vnc_key_sync_capslock(true); vs->modifiers_state[0x3a] = 1; press_key(vs, 0xffe5); } @@ -1819,6 +1828,11 @@ static void vnc_release_modifiers(VncState *vs) } } +static const char *code2name(int keycode) +{ + return QKeyCode_lookup[qemu_input_key_number_to_qcode(keycode)]; +} + static void key_event(VncState *vs, int down, uint32_t sym) { int keycode; @@ -1829,6 +1843,7 @@ static void key_event(VncState *vs, int down, uint32_t sym) } keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF) & SCANCODE_KEYMASK; + trace_vnc_key_event_map(down, sym, keycode, code2name(keycode)); do_key_event(vs, down, keycode, sym); } @@ -1836,10 +1851,12 @@ static void ext_key_event(VncState *vs, int down, uint32_t sym, uint16_t keycode) { /* if the user specifies a keyboard layout, always use it */ - if (keyboard_layout) + if (keyboard_layout) { key_event(vs, down, sym); - else + } else { + trace_vnc_key_event_ext(down, sym, keycode, code2name(keycode)); do_key_event(vs, down, keycode, sym); + } } static void framebuffer_update_request(VncState *vs, int incremental, @@ -2929,10 +2946,12 @@ void vnc_display_init(DisplayState *ds) QTAILQ_INIT(&vs->clients); vs->expires = TIME_MAX; - if (keyboard_layout) + if (keyboard_layout) { + trace_vnc_key_map_init(keyboard_layout); vs->kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout); - else + } else { vs->kbd_layout = init_keyboard_layout(name2keysym, "en-us"); + } if (!vs->kbd_layout) exit(1); -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PULL 3/3] vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16, 24, 32} 2014-06-02 14:33 [Qemu-devel] [PULL 0/3] vnc patch queue Gerd Hoffmann 2014-06-02 14:33 ` [Qemu-devel] [PULL 1/3] vnc: refuse to set a password with VNC_AUTH_NONE Gerd Hoffmann 2014-06-02 14:33 ` [Qemu-devel] [PULL 2/3] vnc: add trace events for key events Gerd Hoffmann @ 2014-06-02 14:33 ` Gerd Hoffmann 2014-06-02 15:09 ` [Qemu-devel] [PULL 0/3] vnc patch queue Peter Maydell 3 siblings, 0 replies; 7+ messages in thread From: Gerd Hoffmann @ 2014-06-02 14:33 UTC (permalink / raw) To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann, Anthony Liguori From: Gonglei <arei.gonglei@huawei.com> Spotted by Coverity: (1) Event assignment: Assigning: "pixels" = "0". (2) Event cond_true: Condition "y < h", taking true branch (3) Event cond_false: Condition "x < w", taking false branch (4) Event loop_end: Reached end of loop (5) Event divide_by_zero: In expression "(stats[0] + stats[1]) * 100U / pixels", division by expression "pixels" which may be zero has undefined behavior. 290 DEFINE_DETECT_FUNCTION(16) 291 DEFINE_DETECT_FUNCTION(32) Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- ui/vnc-enc-tight.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c index 59b59c0..f02352c 100644 --- a/ui/vnc-enc-tight.c +++ b/ui/vnc-enc-tight.c @@ -181,6 +181,10 @@ tight_detect_smooth_image24(VncState *vs, int w, int h) } } + if (pixels == 0) { + return 0; + } + /* 95% smooth or more ... */ if (stats[0] * 33 / pixels >= 95) { return 0; @@ -267,7 +271,9 @@ tight_detect_smooth_image24(VncState *vs, int w, int h) y += w; \ } \ } \ - \ + if (pixels == 0) { \ + return 0; \ + } \ if ((stats[0] + stats[1]) * 100 / pixels >= 90) { \ return 0; \ } \ -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PULL 0/3] vnc patch queue 2014-06-02 14:33 [Qemu-devel] [PULL 0/3] vnc patch queue Gerd Hoffmann ` (2 preceding siblings ...) 2014-06-02 14:33 ` [Qemu-devel] [PULL 3/3] vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16, 24, 32} Gerd Hoffmann @ 2014-06-02 15:09 ` Peter Maydell 3 siblings, 0 replies; 7+ messages in thread From: Peter Maydell @ 2014-06-02 15:09 UTC (permalink / raw) To: Gerd Hoffmann; +Cc: QEMU Developers On 2 June 2014 15:33, Gerd Hoffmann <kraxel@redhat.com> wrote: > Hi, > > Carrying three little patches. > > please pull, > Gerd > > The following changes since commit 9bb931802e6ab5ab6947e3cb9cea934fc0724274: > > Revert "bsd-user: replace fprintf(stderr, ...) with error_report()" (2014-06-02 13:26:59 +0100) > > are available in the git repository at: > > git://git.kraxel.org/qemu tags/pull-vnc-3 > > for you to fetch changes up to b52991537c0efe27ee0c1955eb28a4584226d8b5: > > vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16,24,32} (2014-06-02 16:30:52 +0200) > > ---------------------------------------------------------------- > misc minor vnc patches Applied, thanks. -- PMM ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PULL 0/3] vnc patch queue @ 2015-03-10 11:16 Gerd Hoffmann 2015-03-11 8:44 ` Peter Maydell 0 siblings, 1 reply; 7+ messages in thread From: Gerd Hoffmann @ 2015-03-10 11:16 UTC (permalink / raw) To: qemu-devel; +Cc: Gerd Hoffmann Hi, Here comes the vnc patch queue with a few vnc bugfixes. please pull, Gerd The following changes since commit 277263e1b320d759a760ba6c5ea75ec268f929e5: Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging (2015-03-09 14:04:14 +0000) are available in the git repository at: git://git.kraxel.org/qemu tags/pull-vnc-20150310-1 for you to fetch changes up to b57489cfe48f9fedc10205c0494f144085733f30: Fix crash when connecting to VNC through websocket (2015-03-10 11:33:42 +0100) ---------------------------------------------------------------- vnc bugfixes. ---------------------------------------------------------------- Gerd Hoffmann (2): vnc: set id at parse time not init time vnc: -readconfig fix Jorge Acereda Maciá (1): Fix crash when connecting to VNC through websocket include/ui/console.h | 1 - qmp.c | 1 - ui/vnc-ws.c | 3 +-- ui/vnc.c | 22 ++++++++++++---------- vl.c | 7 +++++-- 5 files changed, 18 insertions(+), 16 deletions(-) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PULL 0/3] vnc patch queue 2015-03-10 11:16 Gerd Hoffmann @ 2015-03-11 8:44 ` Peter Maydell 0 siblings, 0 replies; 7+ messages in thread From: Peter Maydell @ 2015-03-11 8:44 UTC (permalink / raw) To: Gerd Hoffmann; +Cc: QEMU Developers On 10 March 2015 at 11:16, Gerd Hoffmann <kraxel@redhat.com> wrote: > Hi, > > Here comes the vnc patch queue with a few vnc bugfixes. > > please pull, > Gerd > > The following changes since commit 277263e1b320d759a760ba6c5ea75ec268f929e5: > > Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging (2015-03-09 14:04:14 +0000) > > are available in the git repository at: > > > git://git.kraxel.org/qemu tags/pull-vnc-20150310-1 > > for you to fetch changes up to b57489cfe48f9fedc10205c0494f144085733f30: > > Fix crash when connecting to VNC through websocket (2015-03-10 11:33:42 +0100) > > ---------------------------------------------------------------- > vnc bugfixes. Applied, thanks. -- PMM ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-03-11 8:44 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-06-02 14:33 [Qemu-devel] [PULL 0/3] vnc patch queue Gerd Hoffmann 2014-06-02 14:33 ` [Qemu-devel] [PULL 1/3] vnc: refuse to set a password with VNC_AUTH_NONE Gerd Hoffmann 2014-06-02 14:33 ` [Qemu-devel] [PULL 2/3] vnc: add trace events for key events Gerd Hoffmann 2014-06-02 14:33 ` [Qemu-devel] [PULL 3/3] vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16, 24, 32} Gerd Hoffmann 2014-06-02 15:09 ` [Qemu-devel] [PULL 0/3] vnc patch queue Peter Maydell -- strict thread matches above, loose matches on Subject: below -- 2015-03-10 11:16 Gerd Hoffmann 2015-03-11 8:44 ` Peter Maydell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).