comparison src/protocols/oscar/auth.c @ 7167:6d3d8f11e765

[gaim-migrate @ 7734] I, uh, renamed some functions in libfaim. Functions that every file uses. A lot. So it looks like I did a lot of work, but I didn't. Yeah, in a typical work I actually only do about 15 minutes of real work. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 05 Oct 2003 23:50:40 +0000
parents 04dc7fe68889
children 0ed4d53c46f9
comparison
equal deleted inserted replaced
7166:e6b01bd8d6cd 7167:6d3d8f11e765
28 28
29 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x0001, 4+2+2+length))) 29 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x0001, 4+2+2+length)))
30 return -ENOMEM; 30 return -ENOMEM;
31 31
32 aimbs_put32(&fr->data, 0x00000001); 32 aimbs_put32(&fr->data, 0x00000001);
33 aim_addtlvtochain_raw(&tl, 0x0006, length, chipsahoy); 33 aim_tlvlist_add_raw(&tl, 0x0006, length, chipsahoy);
34 aim_writetlvchain(&fr->data, &tl); 34 aim_tlvlist_write(&fr->data, &tl);
35 aim_freetlvchain(&tl); 35 aim_tlvlist_free(&tl);
36 36
37 aim_tx_enqueue(sess, fr); 37 aim_tx_enqueue(sess, fr);
38 38
39 return 0; 39 return 0;
40 } 40 }
138 return -ENOMEM; 138 return -ENOMEM;
139 139
140 snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0); 140 snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0);
141 aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid); 141 aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid);
142 142
143 aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn); 143 aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn);
144 aim_writetlvchain(&fr->data, &tl); 144 aim_tlvlist_write(&fr->data, &tl);
145 aim_freetlvchain(&tl); 145 aim_tlvlist_free(&tl);
146 146
147 aim_tx_enqueue(sess, fr); 147 aim_tx_enqueue(sess, fr);
148 148
149 return 0; 149 return 0;
150 } 150 }
171 } 171 }
172 172
173 aim_encode_password(password, password_encoded); 173 aim_encode_password(password, password_encoded);
174 174
175 aimbs_put32(&fr->data, 0x00000001); /* FLAP Version */ 175 aimbs_put32(&fr->data, 0x00000001); /* FLAP Version */
176 aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn); 176 aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn);
177 aim_addtlvtochain_raw(&tl, 0x0002, passwdlen, password_encoded); 177 aim_tlvlist_add_raw(&tl, 0x0002, passwdlen, password_encoded);
178 178
179 if (ci->clientstring) 179 if (ci->clientstring)
180 aim_addtlvtochain_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); 180 aim_tlvlist_add_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring);
181 aim_addtlvtochain16(&tl, 0x0016, (fu16_t)ci->clientid); 181 aim_tlvlist_add_16(&tl, 0x0016, (fu16_t)ci->clientid);
182 aim_addtlvtochain16(&tl, 0x0017, (fu16_t)ci->major); 182 aim_tlvlist_add_16(&tl, 0x0017, (fu16_t)ci->major);
183 aim_addtlvtochain16(&tl, 0x0018, (fu16_t)ci->minor); 183 aim_tlvlist_add_16(&tl, 0x0018, (fu16_t)ci->minor);
184 aim_addtlvtochain16(&tl, 0x0019, (fu16_t)ci->point); 184 aim_tlvlist_add_16(&tl, 0x0019, (fu16_t)ci->point);
185 aim_addtlvtochain16(&tl, 0x001a, (fu16_t)ci->build); 185 aim_tlvlist_add_16(&tl, 0x001a, (fu16_t)ci->build);
186 aim_addtlvtochain32(&tl, 0x0014, (fu32_t)ci->distrib); /* distribution chan */ 186 aim_tlvlist_add_32(&tl, 0x0014, (fu32_t)ci->distrib); /* distribution chan */
187 aim_addtlvtochain_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); 187 aim_tlvlist_add_raw(&tl, 0x000f, strlen(ci->lang), ci->lang);
188 aim_addtlvtochain_raw(&tl, 0x000e, strlen(ci->country), ci->country); 188 aim_tlvlist_add_raw(&tl, 0x000e, strlen(ci->country), ci->country);
189 189
190 aim_writetlvchain(&fr->data, &tl); 190 aim_tlvlist_write(&fr->data, &tl);
191 191
192 free(password_encoded); 192 free(password_encoded);
193 aim_freetlvchain(&tl); 193 aim_tlvlist_free(&tl);
194 194
195 aim_tx_enqueue(sess, fr); 195 aim_tx_enqueue(sess, fr);
196 196
197 return 0; 197 return 0;
198 } 198 }
249 return -ENOMEM; 249 return -ENOMEM;
250 250
251 snacid = aim_cachesnac(sess, 0x0017, 0x0002, 0x0000, NULL, 0); 251 snacid = aim_cachesnac(sess, 0x0017, 0x0002, 0x0000, NULL, 0);
252 aim_putsnac(&fr->data, 0x0017, 0x0002, 0x0000, snacid); 252 aim_putsnac(&fr->data, 0x0017, 0x0002, 0x0000, snacid);
253 253
254 aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn); 254 aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn);
255 255
256 aim_encode_password_md5(password, key, digest); 256 aim_encode_password_md5(password, key, digest);
257 aim_addtlvtochain_raw(&tl, 0x0025, 16, digest); 257 aim_tlvlist_add_raw(&tl, 0x0025, 16, digest);
258 258
259 /* 259 /*
260 * Newer versions of winaim have an empty type x004c TLV here. 260 * Newer versions of winaim have an empty type x004c TLV here.
261 */ 261 */
262 262
263 if (ci->clientstring) 263 if (ci->clientstring)
264 aim_addtlvtochain_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); 264 aim_tlvlist_add_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring);
265 aim_addtlvtochain16(&tl, 0x0016, (fu16_t)ci->clientid); 265 aim_tlvlist_add_16(&tl, 0x0016, (fu16_t)ci->clientid);
266 aim_addtlvtochain16(&tl, 0x0017, (fu16_t)ci->major); 266 aim_tlvlist_add_16(&tl, 0x0017, (fu16_t)ci->major);
267 aim_addtlvtochain16(&tl, 0x0018, (fu16_t)ci->minor); 267 aim_tlvlist_add_16(&tl, 0x0018, (fu16_t)ci->minor);
268 aim_addtlvtochain16(&tl, 0x0019, (fu16_t)ci->point); 268 aim_tlvlist_add_16(&tl, 0x0019, (fu16_t)ci->point);
269 aim_addtlvtochain16(&tl, 0x001a, (fu16_t)ci->build); 269 aim_tlvlist_add_16(&tl, 0x001a, (fu16_t)ci->build);
270 aim_addtlvtochain32(&tl, 0x0014, (fu32_t)ci->distrib); 270 aim_tlvlist_add_32(&tl, 0x0014, (fu32_t)ci->distrib);
271 aim_addtlvtochain_raw(&tl, 0x000e, strlen(ci->country), ci->country); 271 aim_tlvlist_add_raw(&tl, 0x000e, strlen(ci->country), ci->country);
272 aim_addtlvtochain_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); 272 aim_tlvlist_add_raw(&tl, 0x000f, strlen(ci->lang), ci->lang);
273 273
274 #ifndef NOSSI 274 #ifndef NOSSI
275 /* 275 /*
276 * If set, old-fashioned buddy lists will not work. You will need 276 * If set, old-fashioned buddy lists will not work. You will need
277 * to use SSI. 277 * to use SSI.
278 */ 278 */
279 aim_addtlvtochain8(&tl, 0x004a, 0x01); 279 aim_tlvlist_add_8(&tl, 0x004a, 0x01);
280 #endif 280 #endif
281 281
282 aim_writetlvchain(&fr->data, &tl); 282 aim_tlvlist_write(&fr->data, &tl);
283 283
284 aim_freetlvchain(&tl); 284 aim_tlvlist_free(&tl);
285 285
286 aim_tx_enqueue(sess, fr); 286 aim_tx_enqueue(sess, fr);
287 287
288 return 0; 288 return 0;
289 } 289 }
362 362
363 /* 363 /*
364 * Read block of TLVs. All further data is derived 364 * Read block of TLVs. All further data is derived
365 * from what is parsed here. 365 * from what is parsed here.
366 */ 366 */
367 tlvlist = aim_readtlvchain(bs); 367 tlvlist = aim_tlvlist_read(bs);
368 368
369 /* 369 /*
370 * No matter what, we should have a screen name. 370 * No matter what, we should have a screen name.
371 */ 371 */
372 memset(sess->sn, 0, sizeof(sess->sn)); 372 memset(sess->sn, 0, sizeof(sess->sn));
373 if (aim_gettlv(tlvlist, 0x0001, 1)) { 373 if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) {
374 info->sn = aim_gettlv_str(tlvlist, 0x0001, 1); 374 info->sn = aim_tlv_getstr(tlvlist, 0x0001, 1);
375 strncpy(sess->sn, info->sn, sizeof(sess->sn)); 375 strncpy(sess->sn, info->sn, sizeof(sess->sn));
376 } 376 }
377 377
378 /* 378 /*
379 * Check for an error code. If so, we should also 379 * Check for an error code. If so, we should also
380 * have an error url. 380 * have an error url.
381 */ 381 */
382 if (aim_gettlv(tlvlist, 0x0008, 1)) 382 if (aim_tlv_gettlv(tlvlist, 0x0008, 1))
383 info->errorcode = aim_gettlv16(tlvlist, 0x0008, 1); 383 info->errorcode = aim_tlv_get16(tlvlist, 0x0008, 1);
384 if (aim_gettlv(tlvlist, 0x0004, 1)) 384 if (aim_tlv_gettlv(tlvlist, 0x0004, 1))
385 info->errorurl = aim_gettlv_str(tlvlist, 0x0004, 1); 385 info->errorurl = aim_tlv_getstr(tlvlist, 0x0004, 1);
386 386
387 /* 387 /*
388 * BOS server address. 388 * BOS server address.
389 */ 389 */
390 if (aim_gettlv(tlvlist, 0x0005, 1)) 390 if (aim_tlv_gettlv(tlvlist, 0x0005, 1))
391 info->bosip = aim_gettlv_str(tlvlist, 0x0005, 1); 391 info->bosip = aim_tlv_getstr(tlvlist, 0x0005, 1);
392 392
393 /* 393 /*
394 * Authorization cookie. 394 * Authorization cookie.
395 */ 395 */
396 if (aim_gettlv(tlvlist, 0x0006, 1)) { 396 if (aim_tlv_gettlv(tlvlist, 0x0006, 1)) {
397 aim_tlv_t *tmptlv; 397 aim_tlv_t *tmptlv;
398 398
399 tmptlv = aim_gettlv(tlvlist, 0x0006, 1); 399 tmptlv = aim_tlv_gettlv(tlvlist, 0x0006, 1);
400 400
401 info->cookielen = tmptlv->length; 401 info->cookielen = tmptlv->length;
402 info->cookie = tmptlv->value; 402 info->cookie = tmptlv->value;
403 } 403 }
404 404
407 * Not available for ICQ or @mac.com logins. 407 * Not available for ICQ or @mac.com logins.
408 * If you receive this TLV, then you are allowed to use 408 * If you receive this TLV, then you are allowed to use
409 * family 0x0018 to check the status of your email. 409 * family 0x0018 to check the status of your email.
410 * XXX - Not really true! 410 * XXX - Not really true!
411 */ 411 */
412 if (aim_gettlv(tlvlist, 0x0011, 1)) 412 if (aim_tlv_gettlv(tlvlist, 0x0011, 1))
413 info->email = aim_gettlv_str(tlvlist, 0x0011, 1); 413 info->email = aim_tlv_getstr(tlvlist, 0x0011, 1);
414 414
415 /* 415 /*
416 * The registration status. (Not real sure what it means.) 416 * The registration status. (Not real sure what it means.)
417 * Not available for ICQ or @mac.com logins. 417 * Not available for ICQ or @mac.com logins.
418 * 418 *
424 * to other users or not. AFAIK, this feature is no longer used. 424 * to other users or not. AFAIK, this feature is no longer used.
425 * 425 *
426 * Means you can use the admin family? (0x0007) 426 * Means you can use the admin family? (0x0007)
427 * 427 *
428 */ 428 */
429 if (aim_gettlv(tlvlist, 0x0013, 1)) 429 if (aim_tlv_gettlv(tlvlist, 0x0013, 1))
430 info->regstatus = aim_gettlv16(tlvlist, 0x0013, 1); 430 info->regstatus = aim_tlv_get16(tlvlist, 0x0013, 1);
431 431
432 if (aim_gettlv(tlvlist, 0x0040, 1)) 432 if (aim_tlv_gettlv(tlvlist, 0x0040, 1))
433 info->latestbeta.build = aim_gettlv32(tlvlist, 0x0040, 1); 433 info->latestbeta.build = aim_tlv_get32(tlvlist, 0x0040, 1);
434 if (aim_gettlv(tlvlist, 0x0041, 1)) 434 if (aim_tlv_gettlv(tlvlist, 0x0041, 1))
435 info->latestbeta.url = aim_gettlv_str(tlvlist, 0x0041, 1); 435 info->latestbeta.url = aim_tlv_getstr(tlvlist, 0x0041, 1);
436 if (aim_gettlv(tlvlist, 0x0042, 1)) 436 if (aim_tlv_gettlv(tlvlist, 0x0042, 1))
437 info->latestbeta.info = aim_gettlv_str(tlvlist, 0x0042, 1); 437 info->latestbeta.info = aim_tlv_getstr(tlvlist, 0x0042, 1);
438 if (aim_gettlv(tlvlist, 0x0043, 1)) 438 if (aim_tlv_gettlv(tlvlist, 0x0043, 1))
439 info->latestbeta.name = aim_gettlv_str(tlvlist, 0x0043, 1); 439 info->latestbeta.name = aim_tlv_getstr(tlvlist, 0x0043, 1);
440 if (aim_gettlv(tlvlist, 0x0048, 1)) 440 if (aim_tlv_gettlv(tlvlist, 0x0048, 1))
441 ; /* no idea what this is */ 441 ; /* no idea what this is */
442 442
443 if (aim_gettlv(tlvlist, 0x0044, 1)) 443 if (aim_tlv_gettlv(tlvlist, 0x0044, 1))
444 info->latestrelease.build = aim_gettlv32(tlvlist, 0x0044, 1); 444 info->latestrelease.build = aim_tlv_get32(tlvlist, 0x0044, 1);
445 if (aim_gettlv(tlvlist, 0x0045, 1)) 445 if (aim_tlv_gettlv(tlvlist, 0x0045, 1))
446 info->latestrelease.url = aim_gettlv_str(tlvlist, 0x0045, 1); 446 info->latestrelease.url = aim_tlv_getstr(tlvlist, 0x0045, 1);
447 if (aim_gettlv(tlvlist, 0x0046, 1)) 447 if (aim_tlv_gettlv(tlvlist, 0x0046, 1))
448 info->latestrelease.info = aim_gettlv_str(tlvlist, 0x0046, 1); 448 info->latestrelease.info = aim_tlv_getstr(tlvlist, 0x0046, 1);
449 if (aim_gettlv(tlvlist, 0x0047, 1)) 449 if (aim_tlv_gettlv(tlvlist, 0x0047, 1))
450 info->latestrelease.name = aim_gettlv_str(tlvlist, 0x0047, 1); 450 info->latestrelease.name = aim_tlv_getstr(tlvlist, 0x0047, 1);
451 if (aim_gettlv(tlvlist, 0x0049, 1)) 451 if (aim_tlv_gettlv(tlvlist, 0x0049, 1))
452 ; /* no idea what this is */ 452 ; /* no idea what this is */
453 453
454 /* 454 /*
455 * URL to change password. 455 * URL to change password.
456 */ 456 */
457 if (aim_gettlv(tlvlist, 0x0054, 1)) 457 if (aim_tlv_gettlv(tlvlist, 0x0054, 1))
458 info->chpassurl = aim_gettlv_str(tlvlist, 0x0054, 1); 458 info->chpassurl = aim_tlv_getstr(tlvlist, 0x0054, 1);
459 459
460 /* 460 /*
461 * Unknown. Seen on an @mac.com screen name with value of 0x003f 461 * Unknown. Seen on an @mac.com screen name with value of 0x003f
462 */ 462 */
463 if (aim_gettlv(tlvlist, 0x0055, 1)) 463 if (aim_tlv_gettlv(tlvlist, 0x0055, 1))
464 ; 464 ;
465 465
466 sess->authinfo = info; 466 sess->authinfo = info;
467 467
468 if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003))) 468 if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003)))
469 ret = userfunc(sess, rx, info); 469 ret = userfunc(sess, rx, info);
470 470
471 aim_freetlvchain(&tlvlist); 471 aim_tlvlist_free(&tlvlist);
472 472
473 return ret; 473 return ret;
474 } 474 }
475 475
476 /* 476 /*