comparison libpurple/protocols/oscar/family_auth.c @ 27098:28b5fcfb7444

Check in a change requested by Gregory Cypes from AOL. They want clients to be able to specify the clientstring and distribution id used when authenticating. Seems like a reasonable request. If the UI doesn't change these preferences then the default values from the ClientInfo struct are used.
author Mark Doliner <mark@kingant.net>
date Wed, 10 Jun 2009 07:44:35 +0000
parents 6e1967b0f90b
children 4a62072ea833
comparison
equal deleted inserted replaced
27094:db373b572015 27098:28b5fcfb7444
127 { 127 {
128 FlapFrame *frame; 128 FlapFrame *frame;
129 GSList *tlvlist = NULL; 129 GSList *tlvlist = NULL;
130 int passwdlen; 130 int passwdlen;
131 guint8 *password_encoded; 131 guint8 *password_encoded;
132 const char *clientstring;
133 guint32 distrib;
132 134
133 passwdlen = strlen(password); 135 passwdlen = strlen(password);
134 password_encoded = (guint8 *)g_malloc(passwdlen+1); 136 password_encoded = (guint8 *)g_malloc(passwdlen+1);
135 if (passwdlen > MAXICQPASSLEN) 137 if (passwdlen > MAXICQPASSLEN)
136 passwdlen = MAXICQPASSLEN; 138 passwdlen = MAXICQPASSLEN;
137 139
138 frame = flap_frame_new(od, 0x01, 1152); 140 frame = flap_frame_new(od, 0x01, 1152);
139 141
140 aim_encode_password(password, password_encoded); 142 aim_encode_password(password, password_encoded);
141 143
144 clientstring = purple_prefs_get_string("/plugins/prpl/oscar/clientstring");
145 if (clientstring == NULL)
146 clientstring = ci->clientstring;
147 distrib = purple_prefs_get_int("/plugins/prpl/oscar/distid");
148 if ((gint32)distrib == -1)
149 distrib = ci->distrib;
150
142 byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */ 151 byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */
143 aim_tlvlist_add_str(&tlvlist, 0x0001, sn); 152 aim_tlvlist_add_str(&tlvlist, 0x0001, sn);
144 aim_tlvlist_add_raw(&tlvlist, 0x0002, passwdlen, password_encoded); 153 aim_tlvlist_add_raw(&tlvlist, 0x0002, passwdlen, password_encoded);
145 154
146 if (ci->clientstring) 155 if (clientstring)
147 aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring); 156 aim_tlvlist_add_str(&tlvlist, 0x0003, clientstring);
148 aim_tlvlist_add_16(&tlvlist, 0x0016, (guint16)ci->clientid); 157 aim_tlvlist_add_16(&tlvlist, 0x0016, (guint16)ci->clientid);
149 aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major); 158 aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major);
150 aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor); 159 aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor);
151 aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point); 160 aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point);
152 aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build); 161 aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build);
153 aim_tlvlist_add_32(&tlvlist, 0x0014, (guint32)ci->distrib); /* distribution chan */ 162 aim_tlvlist_add_32(&tlvlist, 0x0014, distrib); /* distribution chan */
154 aim_tlvlist_add_str(&tlvlist, 0x000f, ci->lang); 163 aim_tlvlist_add_str(&tlvlist, 0x000f, ci->lang);
155 aim_tlvlist_add_str(&tlvlist, 0x000e, ci->country); 164 aim_tlvlist_add_str(&tlvlist, 0x000e, ci->country);
156 165
157 aim_tlvlist_write(&frame->data, &tlvlist); 166 aim_tlvlist_write(&frame->data, &tlvlist);
158 167
208 FlapFrame *frame; 217 FlapFrame *frame;
209 GSList *tlvlist = NULL; 218 GSList *tlvlist = NULL;
210 guint8 digest[16]; 219 guint8 digest[16];
211 aim_snacid_t snacid; 220 aim_snacid_t snacid;
212 size_t password_len; 221 size_t password_len;
222 const char *clientstring;
223 guint32 distrib;
213 224
214 if (!ci || !sn || !password) 225 if (!ci || !sn || !password)
215 return -EINVAL; 226 return -EINVAL;
216 227
217 #ifdef USE_XOR_FOR_ICQ 228 #ifdef USE_XOR_FOR_ICQ
234 else if (truncate_pass && password_len > 8) 245 else if (truncate_pass && password_len > 8)
235 password_len = 8; 246 password_len = 8;
236 247
237 aim_encode_password_md5(password, password_len, key, digest); 248 aim_encode_password_md5(password, password_len, key, digest);
238 249
250 clientstring = purple_prefs_get_string("/plugins/prpl/oscar/clientstring");
251 if (clientstring == NULL)
252 clientstring = ci->clientstring;
253 distrib = purple_prefs_get_int("/plugins/prpl/oscar/distid");
254 if ((gint32)distrib == -1)
255 distrib = ci->distrib;
256
239 aim_tlvlist_add_raw(&tlvlist, 0x0025, 16, digest); 257 aim_tlvlist_add_raw(&tlvlist, 0x0025, 16, digest);
240 258
241 #ifndef USE_OLD_MD5 259 #ifndef USE_OLD_MD5
242 aim_tlvlist_add_noval(&tlvlist, 0x004c); 260 aim_tlvlist_add_noval(&tlvlist, 0x004c);
243 #endif 261 #endif
244 262
245 if (ci->clientstring) 263 if (clientstring)
246 aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring); 264 aim_tlvlist_add_str(&tlvlist, 0x0003, clientstring);
247 aim_tlvlist_add_16(&tlvlist, 0x0016, (guint16)ci->clientid); 265 aim_tlvlist_add_16(&tlvlist, 0x0016, (guint16)ci->clientid);
248 aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major); 266 aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major);
249 aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor); 267 aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor);
250 aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point); 268 aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point);
251 aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build); 269 aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build);
252 aim_tlvlist_add_32(&tlvlist, 0x0014, (guint32)ci->distrib); 270 aim_tlvlist_add_32(&tlvlist, 0x0014, distrib);
253 aim_tlvlist_add_str(&tlvlist, 0x000f, ci->lang); 271 aim_tlvlist_add_str(&tlvlist, 0x000f, ci->lang);
254 aim_tlvlist_add_str(&tlvlist, 0x000e, ci->country); 272 aim_tlvlist_add_str(&tlvlist, 0x000e, ci->country);
255 273
256 /* 274 /*
257 * If set, old-fashioned buddy lists will not work. You will need 275 * If set, old-fashioned buddy lists will not work. You will need