comparison src/ntlm.c @ 13088:a91a8a28f61f

[gaim-migrate @ 15450] Compile warning fixes committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 01 Feb 2006 06:04:22 +0000
parents a62e694b35e4
children 7f5b3313dd07
comparison
equal deleted inserted replaced
13087:a62e694b35e4 13088:a91a8a28f61f
202 } else { 202 } else {
203 memcpy(buffer, oldkey, 16); 203 memcpy(buffer, oldkey, 16);
204 } 204 }
205 } 205 }
206 206
207 gchar *gaim_ntlm_gen_type3(gchar *username, gchar *passw, gchar *hostname, gchar *domain, gchar *nonce, guint32 *flags) { 207 gchar *
208 gaim_ntlm_gen_type3(const gchar *username, const gchar *passw, const gchar *hostname, const gchar *domain, gchar *nonce, guint32 *flags)
209 {
208 char lm_pw[14]; 210 char lm_pw[14];
209 unsigned char lm_hpw[21]; 211 unsigned char lm_hpw[21];
210 char sesskey[16]; 212 char sesskey[16];
211 gchar *sessionnonce = nonce; 213 gchar *sessionnonce = nonce;
212 gchar key[8]; 214 gchar key[8];
223 GaimCipher *cipher; 225 GaimCipher *cipher;
224 GaimCipherContext *context; 226 GaimCipherContext *context;
225 char *tmp = 0; 227 char *tmp = 0;
226 int idx = 0; 228 int idx = 0;
227 229
228 /* type3 message initialization */ 230 /* type3 message initialization */
229 tmsg->protocol[0] = 'N'; 231 tmsg->protocol[0] = 'N';
230 tmsg->protocol[1] = 'T'; 232 tmsg->protocol[1] = 'T';
231 tmsg->protocol[2] = 'L'; 233 tmsg->protocol[2] = 'L';
232 tmsg->protocol[3] = 'M'; 234 tmsg->protocol[3] = 'M';
233 tmsg->protocol[4] = 'S'; 235 tmsg->protocol[4] = 'S';
260 tmp += strlen(domain); 262 tmp += strlen(domain);
261 strcpy(tmp, username); 263 strcpy(tmp, username);
262 tmp += strlen(username); 264 tmp += strlen(username);
263 strcpy(tmp, hostname); 265 strcpy(tmp, hostname);
264 tmp += strlen(hostname); 266 tmp += strlen(hostname);
265 267
266 /* LM */ 268 /* LM */
267 if (len > 14) len = 14; 269 if (len > 14) len = 14;
268 270
269 for (idx=0; idx<len; idx++) 271 for (idx=0; idx<len; idx++)
270 lm_pw[idx] = g_ascii_toupper(passw[idx]); 272 lm_pw[idx] = g_ascii_toupper(passw[idx]);
311 memcpy(tmp, sesskey, 0x10); 313 memcpy(tmp, sesskey, 0x10);
312 } 314 }
313 315
314 /*tmsg->flags2 = 0x0a280105; 316 /*tmsg->flags2 = 0x0a280105;
315 tmsg->flags3 = 0x0f000000;*/ 317 tmsg->flags3 = 0x0f000000;*/
316 318
317 tmp = gaim_base64_encode((guchar*) tmsg, msglen); 319 tmp = gaim_base64_encode((guchar*) tmsg, msglen);
318 g_free(tmsg); 320 g_free(tmsg);
319 return tmp; 321 return tmp;
320 } 322 }