Mercurial > pidgin
diff src/protocols/oscar/icq.c @ 5345:bfe98c4d331e
[gaim-migrate @ 5721]
ICQ has a maximum password length of 8 characters, apparently. I made
Gaim truncate that shizzle for ICQ.
This fixes this:
http://sourceforge.net/tracker/?func=detail&aid=732409&group_id=235&atid=100235
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 10 May 2003 15:33:48 +0000 |
parents | 46fb754a3c10 |
children | 6d3d8f11e765 |
line wrap: on
line diff
--- a/src/protocols/oscar/icq.c Sat May 10 12:47:17 2003 +0000 +++ b/src/protocols/oscar/icq.c Sat May 10 15:33:48 2003 +0000 @@ -105,12 +105,20 @@ return 0; } +/** + * Change your ICQ password. + * + * @param sess The oscar session + * @param passwd The new password. If this is longer than 8 characters it + * will be truncated. + * @return Return 0 if no errors, otherwise return the error number. + */ faim_export int aim_icq_changepasswd(aim_session_t *sess, const char *passwd) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; - int bslen; + int bslen, passwdlen; if (!passwd) return -EINVAL; @@ -118,7 +126,10 @@ if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) return -EINVAL; - bslen = 2+4+2+2+2+2+strlen(passwd)+1; + passwdlen = strlen(passwd); + if (passwdlen > MAXICQPASSLEN) + passwdlen = MAXICQPASSLEN; + bslen = 2+4+2+2+2+2+passwdlen+1; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) return -ENOMEM; @@ -135,8 +146,8 @@ aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ aimbs_putle16(&fr->data, 0x042e); /* shrug. */ - aimbs_putle16(&fr->data, strlen(passwd)+1); - aimbs_putraw(&fr->data, passwd, strlen(passwd)); + aimbs_putle16(&fr->data, passwdlen+1); + aimbs_putraw(&fr->data, passwd, passwdlen); aimbs_putle8(&fr->data, '\0'); aim_tx_enqueue(sess, fr);