| 166 } |
166 } |
| 167 |
167 |
| 168 static int jabber_sasl_cb_secret(sasl_conn_t *conn, void *ctx, int id, sasl_secret_t **secret) |
168 static int jabber_sasl_cb_secret(sasl_conn_t *conn, void *ctx, int id, sasl_secret_t **secret) |
| 169 { |
169 { |
| 170 JabberStream *js = (JabberStream *)ctx; |
170 JabberStream *js = (JabberStream *)ctx; |
| 171 const char *pw = purple_account_get_password(js->gc->account); |
171 const char *pw = purple_connection_get_password(js->gc); |
| 172 size_t len; |
172 size_t len; |
| 173 static sasl_secret_t *x = NULL; |
173 static sasl_secret_t *x = NULL; |
| 174 |
174 |
| 175 if (!conn || !secret || id != SASL_CB_PASS) |
175 if (!conn || !secret || id != SASL_CB_PASS) |
| 176 return SASL_BADPARAM; |
176 return SASL_BADPARAM; |
| 318 |
318 |
| 319 /* Firstly, if we don't have a password try |
319 /* Firstly, if we don't have a password try |
| 320 * to get one |
320 * to get one |
| 321 */ |
321 */ |
| 322 |
322 |
| 323 if (!purple_account_get_password(js->gc->account)) { |
323 if (!purple_connection_get_password(js->gc)) { |
| 324 purple_account_request_password(js->gc->account, G_CALLBACK(auth_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc); |
324 purple_account_request_password(js->gc->account, G_CALLBACK(auth_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc); |
| 325 return; |
325 return; |
| 326 |
326 |
| 327 /* If we've got a password, but aren't sending |
327 /* If we've got a password, but aren't sending |
| 328 * it in plaintext, see if we can turn on |
328 * it in plaintext, see if we can turn on |
| 455 js->sasl_cb[id].id = SASL_CB_USER; |
455 js->sasl_cb[id].id = SASL_CB_USER; |
| 456 js->sasl_cb[id].proc = jabber_sasl_cb_simple; |
456 js->sasl_cb[id].proc = jabber_sasl_cb_simple; |
| 457 js->sasl_cb[id].context = (void *)js; |
457 js->sasl_cb[id].context = (void *)js; |
| 458 id++; |
458 id++; |
| 459 |
459 |
| 460 if (purple_account_get_password(js->gc->account) != NULL ) { |
460 if (purple_connection_get_password(js->gc) != NULL ) { |
| 461 js->sasl_cb[id].id = SASL_CB_PASS; |
461 js->sasl_cb[id].id = SASL_CB_PASS; |
| 462 js->sasl_cb[id].proc = jabber_sasl_cb_secret; |
462 js->sasl_cb[id].proc = jabber_sasl_cb_secret; |
| 463 js->sasl_cb[id].context = (void *)js; |
463 js->sasl_cb[id].context = (void *)js; |
| 464 id++; |
464 id++; |
| 465 } |
465 } |
| 708 /* If we have Cyrus SASL, then passwords will have been set |
708 /* If we have Cyrus SASL, then passwords will have been set |
| 709 * to OPTIONAL for this protocol. So, we need to do our own |
709 * to OPTIONAL for this protocol. So, we need to do our own |
| 710 * password prompting here |
710 * password prompting here |
| 711 */ |
711 */ |
| 712 |
712 |
| 713 if (!purple_account_get_password(js->gc->account)) { |
713 if (!purple_connection_get_password(js->gc)) { |
| 714 purple_account_request_password(js->gc->account, G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc); |
714 purple_account_request_password(js->gc->account, G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc); |
| 715 return; |
715 return; |
| 716 } |
716 } |
| 717 #endif |
717 #endif |
| 718 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:auth"); |
718 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:auth"); |