diff options
Diffstat (limited to 'vnc/vnc.c')
-rw-r--r-- | vnc/vnc.c | 29 |
1 files changed, 25 insertions, 4 deletions
@@ -53,11 +53,31 @@ void DEFAULT_CC rfbEncryptBytes(char *bytes, char *passwd) { char key[24]; + char passwd_hash[20]; + char passwd_hash_text[40]; void *des; + void *sha1; + int len; + int passwd_bytes; + + /* create password hash from passowrd */ + passwd_bytes = g_strlen(passwd); + sha1 = ssl_sha1_info_create(); + ssl_sha1_transform(sha1, "xrdp_vnc", 8); + ssl_sha1_transform(sha1, passwd, passwd_bytes); + ssl_sha1_transform(sha1, passwd, passwd_bytes); + ssl_sha1_complete(sha1, passwd_hash); + ssl_sha1_info_delete(sha1); + g_snprintf(passwd_hash_text, 39, "%2.2x%2.2x%2.2x%2.2x", + (tui8)passwd_hash[0], (tui8)passwd_hash[1], + (tui8)passwd_hash[2], (tui8)passwd_hash[3]); + passwd_hash_text[39] = 0; + passwd = passwd_hash_text; /* key is simply password padded with nulls */ g_memset(key, 0, sizeof(key)); - g_mirror_memcpy(key, passwd, g_strlen(passwd)); + len = MIN(g_strlen(passwd), 8); + g_mirror_memcpy(key, passwd, len); des = ssl_des3_encrypt_info_create(key, 0); ssl_des3_encrypt(des, 8, bytes, bytes); ssl_des3_info_delete(des); @@ -671,7 +691,7 @@ lib_framebuffer_update(struct vnc *v) } } - /* keep these in 32x32, vnc cursor can be alot bigger */ + /* keep these in 32x32, vnc cursor can be a lot bigger */ if (x > 31) { x = 31; @@ -1021,7 +1041,7 @@ lib_mod_connect(struct vnc *v) if (error == 0) { v->server_msg(v, "VNC tcp connected", 0); - /* protocal version */ + /* protocol version */ init_stream(s, 8192); error = trans_force_read_s(v->trans, s, 12); if (error == 0) @@ -1079,7 +1099,8 @@ lib_mod_connect(struct vnc *v) if (error != 0) { - log_message(LOG_LEVEL_DEBUG, "VNC Error after security negotiation"); + log_message(LOG_LEVEL_DEBUG, "VNC error %d after security negotiation", + error); } if (error == 0 && check_sec_result) |