]> git.proxmox.com Git - pve-qemu-kvm.git/blame - debian/patches/vencrypt-auth-plain.patch
updates for qemu 1.4.0
[pve-qemu-kvm.git] / debian / patches / vencrypt-auth-plain.patch
CommitLineData
7b68d5de
DM
1Index: new/ui/vnc-auth-vencrypt.c
2===================================================================
92bf040c
DM
3--- new.orig/ui/vnc-auth-vencrypt.c 2013-02-11 11:18:48.000000000 +0100
4+++ new/ui/vnc-auth-vencrypt.c 2013-02-11 11:54:47.000000000 +0100
5@@ -25,7 +25,7 @@
6 */
7
8 #include "vnc.h"
9-#include "qemu_socket.h"
10+#include "qemu/sockets.h"
11
12 static int protocol_client_auth_plain(VncState *vs, uint8_t *data, size_t len)
13 {
4e76d234
AD
14@@ -143,6 +143,11 @@
15 vnc_read_when(vs, protocol_client_auth_plain_start, 8);
16 break;
17
18+ case VNC_AUTH_VENCRYPT_PLAIN:
19+ VNC_DEBUG("Start auth PLAIN\n");
20+ vnc_read_when(vs, protocol_client_auth_plain_start, 8);
21+ break;
22+
23 case VNC_AUTH_VENCRYPT_TLSVNC:
24 case VNC_AUTH_VENCRYPT_X509VNC:
25 VNC_DEBUG("Start TLS auth VNC\n");
2802c577 26@@ -227,25 +232,32 @@
4e76d234
AD
27 {
28 int auth = read_u32(data, 0);
29
30- if (auth != vs->subauth) {
31+ if (auth != vs->subauth && auth != VNC_AUTH_VENCRYPT_PLAIN) {
32 VNC_DEBUG("Rejecting auth %d\n", auth);
33 vnc_write_u8(vs, 0); /* Reject auth */
34 vnc_flush(vs);
35 vnc_client_error(vs);
36 } else {
37- VNC_DEBUG("Accepting auth %d, setting up TLS for handshake\n", auth);
38- vnc_write_u8(vs, 1); /* Accept auth */
39- vnc_flush(vs);
40-
41- if (vnc_tls_client_setup(vs, NEED_X509_AUTH(vs)) < 0) {
42- VNC_DEBUG("Failed to setup TLS\n");
43- return 0;
44+ if (auth == VNC_AUTH_VENCRYPT_PLAIN) {
7b68d5de 45+ vs->subauth = auth;
4e76d234
AD
46+ start_auth_vencrypt_subauth(vs);
47 }
48-
49- VNC_DEBUG("Start TLS VeNCrypt handshake process\n");
50- if (vnc_start_vencrypt_handshake(vs) < 0) {
51- VNC_DEBUG("Failed to start TLS handshake\n");
52- return 0;
53+ else
54+ {
55+ VNC_DEBUG("Accepting auth %d, setting up TLS for handshake\n", auth);
56+ vnc_write_u8(vs, 1); /* Accept auth */
7b68d5de 57+ vnc_flush(vs);
4e76d234
AD
58+
59+ if (vnc_tls_client_setup(vs, NEED_X509_AUTH(vs)) < 0) {
60+ VNC_DEBUG("Failed to setup TLS\n");
61+ return 0;
62+ }
63+
64+ VNC_DEBUG("Start TLS VeNCrypt handshake process\n");
65+ if (vnc_start_vencrypt_handshake(vs) < 0) {
66+ VNC_DEBUG("Failed to start TLS handshake\n");
67+ return 0;
68+ }
69 }
70 }
71 return 0;
2802c577 72@@ -260,10 +272,11 @@
4e76d234
AD
73 vnc_flush(vs);
74 vnc_client_error(vs);
75 } else {
76- VNC_DEBUG("Sending allowed auth %d\n", vs->subauth);
77+ VNC_DEBUG("Sending allowed auths %d %d\n", vs->subauth, VNC_AUTH_VENCRYPT_PLAIN);
78 vnc_write_u8(vs, 0); /* Accept version */
79- vnc_write_u8(vs, 1); /* Number of sub-auths */
80+ vnc_write_u8(vs, 2); /* Number of sub-auths */
81 vnc_write_u32(vs, vs->subauth); /* The supported auth */
82+ vnc_write_u32(vs, VNC_AUTH_VENCRYPT_PLAIN); /* Alternative supported auth */
83 vnc_flush(vs);
84 vnc_read_when(vs, protocol_client_vencrypt_auth, 4);
85 }