Mercurial > pidgin
comparison src/ntlm.c @ 13087:a62e694b35e4
[gaim-migrate @ 15449]
ntlm: use a random session key
committer: Tailor Script <tailor@pidgin.im>
author | Thomas Butter <tbutter> |
---|---|
date | Tue, 31 Jan 2006 22:00:34 +0000 |
parents | 31a3a9af1494 |
children | a91a8a28f61f |
comparison
equal
deleted
inserted
replaced
13086:6c772241a6f8 | 13087:a62e694b35e4 |
---|---|
191 | 191 |
192 setup_des_key(keys+14, (char*)key); | 192 setup_des_key(keys+14, (char*)key); |
193 des_ecb_encrypt((char*)plaintext, (char*)(results+16), (char*)key); | 193 des_ecb_encrypt((char*)plaintext, (char*)(results+16), (char*)key); |
194 } | 194 } |
195 | 195 |
196 char sesskey[16] = { (char) 0xff, (char) 0xff, (char) 0xad, | 196 static void gensesskey(char *buffer, char *oldkey) { |
197 (char) 0xf5, (char) 0xc8, (char) 0xff, | 197 int i = 0; |
198 (char) 0x67, (char) 0x66, (char) 0xf6, | 198 if(oldkey == NULL) { |
199 (char) 0x80, (char) 0xe8, (char) 0x34, | 199 for(i=0; i<16; i++) { |
200 (char) 0xd7, (char) 0x8d, (char) 0x28, | 200 buffer[i] = (char)(rand() & 0xff); |
201 (char) 0x2b }; | 201 } |
202 } else { | |
203 memcpy(buffer, oldkey, 16); | |
204 } | |
205 } | |
202 | 206 |
203 gchar *gaim_ntlm_gen_type3(gchar *username, gchar *passw, gchar *hostname, gchar *domain, gchar *nonce, guint32 *flags) { | 207 gchar *gaim_ntlm_gen_type3(gchar *username, gchar *passw, gchar *hostname, gchar *domain, gchar *nonce, guint32 *flags) { |
204 char lm_pw[14]; | 208 char lm_pw[14]; |
205 unsigned char lm_hpw[21]; | 209 unsigned char lm_hpw[21]; |
210 char sesskey[16]; | |
206 gchar *sessionnonce = nonce; | 211 gchar *sessionnonce = nonce; |
207 gchar key[8]; | 212 gchar key[8]; |
208 int msglen = sizeof(struct type3_message)+ | 213 int msglen = sizeof(struct type3_message)+ |
209 strlen(domain) + strlen(username)+ | 214 strlen(domain) + strlen(username)+ |
210 strlen(hostname) + 24 +24 + ((flags) ? 16 : 0); | 215 strlen(hostname) + 24 +24 + ((flags) ? 16 : 0); |
300 | 305 |
301 | 306 |
302 /* LCS Stuff */ | 307 /* LCS Stuff */ |
303 if(flags) { | 308 if(flags) { |
304 tmsg->flags = 0x409082d4; | 309 tmsg->flags = 0x409082d4; |
310 gensesskey(sesskey, NULL); | |
305 memcpy(tmp, sesskey, 0x10); | 311 memcpy(tmp, sesskey, 0x10); |
306 } | 312 } |
307 | 313 |
308 /*tmsg->flags2 = 0x0a280105; | 314 /*tmsg->flags2 = 0x0a280105; |
309 tmsg->flags3 = 0x0f000000;*/ | 315 tmsg->flags3 = 0x0f000000;*/ |