1 Index: qemu-kvm/console.h
2 ===================================================================
3 --- qemu-kvm.orig/console.h 2009-12-21 10:37:57.000000000 +0100
4 +++ qemu-kvm/console.h 2009-12-21 10:45:29.000000000 +0100
6 void vnc_display_init(DisplayState *ds);
7 void vnc_display_close(DisplayState *ds);
8 int vnc_display_open(DisplayState *ds, const char *display);
9 -int vnc_display_password(DisplayState *ds, const char *password);
10 +int vnc_display_password(DisplayState *ds, const char *password, int limit);
11 void do_info_vnc_print(Monitor *mon, const QObject *data);
12 void do_info_vnc(Monitor *mon, QObject **ret_data);
13 char *vnc_display_local_addr(DisplayState *ds);
14 Index: qemu-kvm/monitor.c
15 ===================================================================
16 --- qemu-kvm.orig/monitor.c 2009-12-21 10:37:58.000000000 +0100
17 +++ qemu-kvm/monitor.c 2009-12-21 11:03:40.000000000 +0100
19 monitor_read_bdrv_key_start(mon, bs, NULL, NULL);
22 -static void change_vnc_password(const char *password)
23 +static void change_vnc_password(const char *password, int limit)
25 - if (vnc_display_password(NULL, password) < 0)
26 + if (vnc_display_password(NULL, password, limit) < 0)
27 qemu_error_new(QERR_SET_PASSWD_FAILED);
31 static void change_vnc_password_cb(Monitor *mon, const char *password,
34 - change_vnc_password(password);
35 + change_vnc_password(password, 0);
36 + monitor_read_command(mon, 1);
39 +static void change_vnc_ticket_cb(Monitor *mon, const char *password,
42 + change_vnc_password(password, 1);
43 monitor_read_command(mon, 1);
46 static void do_change_vnc(Monitor *mon, const char *target, const char *arg)
48 if (strcmp(target, "passwd") == 0 ||
49 - strcmp(target, "password") == 0) {
50 + strcmp(target, "password") == 0 ||
51 + strcmp(target, "ticket") == 0) {
54 strncpy(password, arg, sizeof(password));
55 password[sizeof(password) - 1] = '\0';
56 - change_vnc_password(password);
57 + if (strcmp(target, "ticket") == 0)
58 + change_vnc_ticket_cb(mon, password, NULL);
60 + change_vnc_password_cb(mon, password, NULL);
62 monitor_read_password(mon, change_vnc_password_cb, NULL);
65 ===================================================================
66 --- qemu-kvm.orig/vnc.c 2009-12-21 10:37:57.000000000 +0100
67 +++ qemu-kvm/vnc.c 2009-12-21 10:44:13.000000000 +0100
69 static void set_pixel_conversion(VncState *vs)
71 if ((vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG) ==
72 - (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG) &&
73 + (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG) &&
74 !memcmp(&(vs->clientds.pf), &(vs->ds->surface->pf), sizeof(PixelFormat))) {
75 vs->write_pixels = vnc_write_pixels_copy;
76 switch (vs->ds->surface->pf.bits_per_pixel) {
78 vnc_write_u8(vs, 0); /* msg id */
80 vnc_write_u16(vs, 1); /* number of rects */
81 - vnc_framebuffer_update(vs, 0, 0, ds_get_width(vs->ds),
82 + vnc_framebuffer_update(vs, 0, 0, ds_get_width(vs->ds),
83 ds_get_height(vs->ds), VNC_ENCODING_WMVi);
84 pixel_format_message(vs);
86 @@ -2068,7 +2068,10 @@
90 - if (!vs->vd->password || !vs->vd->password[0]) {
91 + if (vs->vd->retries >= 0)
94 + if (!vs->vd->password || !vs->vd->password[0] || vs->vd->retries > 3) {
95 VNC_DEBUG("No password configured on server");
96 vnc_write_u32(vs, 1); /* Reject auth */
102 -int vnc_display_password(DisplayState *ds, const char *password)
103 +int vnc_display_password(DisplayState *ds, const char *password, int limit)
105 VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
107 @@ -2453,6 +2456,7 @@
108 if (password && password[0]) {
109 if (!(vs->password = qemu_strdup(password)))
111 + vs->retries = limit ? 0 : -1;
112 if (vs->auth == VNC_AUTH_NONE) {
113 vs->auth = VNC_AUTH_VNC;
115 Index: qemu-kvm/vnc.h
116 ===================================================================
117 --- qemu-kvm.orig/vnc.h 2009-12-21 10:37:57.000000000 +0100
118 +++ qemu-kvm/vnc.h 2009-12-21 10:44:13.000000000 +0100
125 #ifdef CONFIG_VNC_TLS
126 int subauth; /* Used by VeNCrypt */