]>
Commit | Line | Data |
---|---|---|
4676c0af DM |
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 | |
5 | @@ -322,7 +322,7 @@ | |
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 | |
18 | @@ -949,9 +949,9 @@ | |
19 | monitor_read_bdrv_key_start(mon, bs, NULL, NULL); | |
20 | } | |
21 | ||
22 | -static void change_vnc_password(const char *password) | |
23 | +static void change_vnc_password(const char *password, int limit) | |
24 | { | |
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); | |
28 | ||
29 | } | |
30 | @@ -959,19 +959,30 @@ | |
31 | static void change_vnc_password_cb(Monitor *mon, const char *password, | |
32 | void *opaque) | |
33 | { | |
34 | - change_vnc_password(password); | |
35 | + change_vnc_password(password, 0); | |
36 | + monitor_read_command(mon, 1); | |
37 | +} | |
38 | + | |
39 | +static void change_vnc_ticket_cb(Monitor *mon, const char *password, | |
40 | + void *opaque) | |
41 | +{ | |
42 | + change_vnc_password(password, 1); | |
43 | monitor_read_command(mon, 1); | |
44 | } | |
45 | ||
46 | static void do_change_vnc(Monitor *mon, const char *target, const char *arg) | |
47 | { | |
48 | if (strcmp(target, "passwd") == 0 || | |
49 | - strcmp(target, "password") == 0) { | |
50 | + strcmp(target, "password") == 0 || | |
51 | + strcmp(target, "ticket") == 0) { | |
52 | if (arg) { | |
53 | char password[9]; | |
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); | |
59 | + else | |
60 | + change_vnc_password_cb(mon, password, NULL); | |
61 | } else { | |
62 | monitor_read_password(mon, change_vnc_password_cb, NULL); | |
63 | } | |
64 | Index: qemu-kvm/vnc.c | |
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 | |
68 | @@ -1763,7 +1763,7 @@ | |
69 | static void set_pixel_conversion(VncState *vs) | |
70 | { | |
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) { | |
77 | @@ -1871,7 +1871,7 @@ | |
78 | vnc_write_u8(vs, 0); /* msg id */ | |
79 | vnc_write_u8(vs, 0); | |
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); | |
85 | vnc_flush(vs); | |
86 | @@ -2068,7 +2068,10 @@ | |
87 | int i, j, pwlen; | |
88 | unsigned char key[8]; | |
89 | ||
90 | - if (!vs->vd->password || !vs->vd->password[0]) { | |
91 | + if (vs->vd->retries >= 0) | |
92 | + vs->vd->retries++; | |
93 | + | |
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 */ | |
97 | if (vs->minor >= 8) { | |
98 | @@ -2438,7 +2441,7 @@ | |
99 | #endif | |
100 | } | |
101 | ||
102 | -int vnc_display_password(DisplayState *ds, const char *password) | |
103 | +int vnc_display_password(DisplayState *ds, const char *password, int limit) | |
104 | { | |
105 | VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display; | |
106 | ||
107 | @@ -2453,6 +2456,7 @@ | |
108 | if (password && password[0]) { | |
109 | if (!(vs->password = qemu_strdup(password))) | |
110 | return -1; | |
111 | + vs->retries = limit ? 0 : -1; | |
112 | if (vs->auth == VNC_AUTH_NONE) { | |
113 | vs->auth = VNC_AUTH_VNC; | |
114 | } | |
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 | |
119 | @@ -104,6 +104,7 @@ | |
120 | ||
121 | char *display; | |
122 | char *password; | |
123 | + int retries; | |
124 | int auth; | |
125 | #ifdef CONFIG_VNC_TLS | |
126 | int subauth; /* Used by VeNCrypt */ |