From 4cefa21dd40a5dd5a8a3efd4225dee9b4af2c670 Mon Sep 17 00:00:00 2001 From: Matt Chapman Date: Sun, 15 Sep 2002 12:36:55 +0000 Subject: [PATCH] #ifdef out licence save code. I don't think it's really necessary; it's always been broken and AFAIK no-one has complained. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@158 423420c4-83ab-492f-b58f-81f9feb106b5 --- licence.c | 31 +++++++++++++++++++------------ rdesktop.c | 2 ++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/licence.c b/licence.c index b0615ef..8098e94 100644 --- a/licence.c +++ b/licence.c @@ -55,6 +55,7 @@ licence_generate_hwid(uint8 * hwid) strncpy((char *) (hwid + 4), hostname, LICENCE_HWID_SIZE - 4); } +#ifdef SAVE_LICENCE /* Present an existing licence to the server */ static void licence_present(uint8 * client_random, uint8 * rsa_data, @@ -94,6 +95,7 @@ licence_present(uint8 * client_random, uint8 * rsa_data, s_mark_end(s); sec_send(s, sec_flags); } +#endif /* Send a licence request packet */ static void @@ -152,23 +154,25 @@ licence_process_demand(STREAM s) memset(null_data, 0, sizeof(null_data)); licence_generate_keys(null_data, server_random, null_data); +#ifdef SAVE_LICENCE licence_size = load_licence(&licence_data); - if (licence_size == -1) + if (licence_size != -1) { - licence_send_request(null_data, null_data, username, hostname); + /* Generate a signature for the HWID buffer */ + licence_generate_hwid(hwid); + sec_sign(signature, 16, licence_sign_key, 16, hwid, sizeof(hwid)); + + /* Now encrypt the HWID */ + RC4_set_key(&crypt_key, 16, licence_key); + RC4(&crypt_key, sizeof(hwid), hwid, hwid); + + licence_present(null_data, null_data, licence_data, licence_size, hwid, signature); + xfree(licence_data); return; } +#endif - /* Generate a signature for the HWID buffer */ - licence_generate_hwid(hwid); - sec_sign(signature, 16, licence_sign_key, 16, hwid, sizeof(hwid)); - - /* Now encrypt the HWID */ - RC4_set_key(&crypt_key, 16, licence_key); - RC4(&crypt_key, sizeof(hwid), hwid, hwid); - - licence_present(null_data, null_data, licence_data, licence_size, hwid, signature); - xfree(licence_data); + licence_send_request(null_data, null_data, username, hostname); } /* Send an authentication response packet */ @@ -276,7 +280,10 @@ licence_process_issue(STREAM s) return; licence_issued = True; + +#ifdef SAVE_LICENCE save_licence(s->p, length - 2); +#endif } /* Process a licence packet */ diff --git a/rdesktop.c b/rdesktop.c index 690ffb4..db8865d 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -388,6 +388,7 @@ hexdump(unsigned char *p, unsigned int len) } } +#ifdef SAVE_LICENCE int load_licence(unsigned char **data) { @@ -441,3 +442,4 @@ save_licence(unsigned char *data, int length) write(fd, data, length); close(fd); } +#endif