Mercurial > pidgin
comparison libpurple/protocols/jabber/auth_cyrus.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | f24f4e47dedb |
children |
comparison
equal
deleted
inserted
replaced
32818:01ff09d4a463 | 32819:2c6510167895 |
---|---|
32 char **error); | 32 char **error); |
33 static void jabber_sasl_build_callbacks(JabberStream *); | 33 static void jabber_sasl_build_callbacks(JabberStream *); |
34 | 34 |
35 static void disallow_plaintext_auth(PurpleAccount *account) | 35 static void disallow_plaintext_auth(PurpleAccount *account) |
36 { | 36 { |
37 purple_connection_error_reason(purple_account_get_connection(account), | 37 purple_connection_error(purple_account_get_connection(account), |
38 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, | 38 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
39 _("Server may require plaintext authentication over an unencrypted stream")); | 39 _("Server may require plaintext authentication over an unencrypted stream")); |
40 } | 40 } |
41 | 41 |
42 static void start_cyrus_wrapper(JabberStream *js) | 42 static void start_cyrus_wrapper(JabberStream *js) |
44 char *error = NULL; | 44 char *error = NULL; |
45 xmlnode *response = NULL; | 45 xmlnode *response = NULL; |
46 JabberSaslState state = jabber_auth_start_cyrus(js, &response, &error); | 46 JabberSaslState state = jabber_auth_start_cyrus(js, &response, &error); |
47 | 47 |
48 if (state == JABBER_SASL_STATE_FAIL) { | 48 if (state == JABBER_SASL_STATE_FAIL) { |
49 purple_connection_error_reason(js->gc, | 49 purple_connection_error(js->gc, |
50 PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, | 50 PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, |
51 error); | 51 error); |
52 g_free(error); | 52 g_free(error); |
53 } else if (response) { | 53 } else if (response) { |
54 jabber_send(js, response); | 54 jabber_send(js, response); |
165 | 165 |
166 static void | 166 static void |
167 auth_no_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields) | 167 auth_no_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
168 { | 168 { |
169 PurpleAccount *account; | 169 PurpleAccount *account; |
170 JabberStream *js; | |
171 | 170 |
172 /* The password prompt dialog doesn't get disposed if the account disconnects */ | 171 /* The password prompt dialog doesn't get disposed if the account disconnects */ |
173 if (!PURPLE_CONNECTION_IS_VALID(gc)) | 172 if (!PURPLE_CONNECTION_IS_VALID(gc)) |
174 return; | 173 return; |
175 | 174 |
359 if (js->sasl_cb == NULL) | 358 if (js->sasl_cb == NULL) |
360 js->sasl_cb = g_new0(sasl_callback_t,6); | 359 js->sasl_cb = g_new0(sasl_callback_t,6); |
361 | 360 |
362 id = 0; | 361 id = 0; |
363 js->sasl_cb[id].id = SASL_CB_GETREALM; | 362 js->sasl_cb[id].id = SASL_CB_GETREALM; |
364 js->sasl_cb[id].proc = jabber_sasl_cb_realm; | 363 js->sasl_cb[id].proc = (void *)jabber_sasl_cb_realm; |
365 js->sasl_cb[id].context = (void *)js; | 364 js->sasl_cb[id].context = (void *)js; |
366 id++; | 365 id++; |
367 | 366 |
368 js->sasl_cb[id].id = SASL_CB_AUTHNAME; | 367 js->sasl_cb[id].id = SASL_CB_AUTHNAME; |
369 js->sasl_cb[id].proc = jabber_sasl_cb_simple; | 368 js->sasl_cb[id].proc = (void *)jabber_sasl_cb_simple; |
370 js->sasl_cb[id].context = (void *)js; | 369 js->sasl_cb[id].context = (void *)js; |
371 id++; | 370 id++; |
372 | 371 |
373 js->sasl_cb[id].id = SASL_CB_USER; | 372 js->sasl_cb[id].id = SASL_CB_USER; |
374 js->sasl_cb[id].proc = jabber_sasl_cb_simple; | 373 js->sasl_cb[id].proc = (void *)jabber_sasl_cb_simple; |
375 js->sasl_cb[id].context = (void *)js; | 374 js->sasl_cb[id].context = (void *)js; |
376 id++; | 375 id++; |
377 | 376 |
378 account = purple_connection_get_account(js->gc); | 377 account = purple_connection_get_account(js->gc); |
379 if (purple_account_get_password(account) != NULL ) { | 378 if (purple_account_get_password(account) != NULL ) { |
380 js->sasl_cb[id].id = SASL_CB_PASS; | 379 js->sasl_cb[id].id = SASL_CB_PASS; |
381 js->sasl_cb[id].proc = jabber_sasl_cb_secret; | 380 js->sasl_cb[id].proc = (void *)jabber_sasl_cb_secret; |
382 js->sasl_cb[id].context = (void *)js; | 381 js->sasl_cb[id].context = (void *)js; |
383 id++; | 382 id++; |
384 } | 383 } |
385 | 384 |
386 js->sasl_cb[id].id = SASL_CB_LOG; | 385 js->sasl_cb[id].id = SASL_CB_LOG; |
387 js->sasl_cb[id].proc = jabber_sasl_cb_log; | 386 js->sasl_cb[id].proc = (void *)jabber_sasl_cb_log; |
388 js->sasl_cb[id].context = (void*)js; | 387 js->sasl_cb[id].context = (void*)js; |
389 id++; | 388 id++; |
390 | 389 |
391 js->sasl_cb[id].id = SASL_CB_LIST_END; | 390 js->sasl_cb[id].id = SASL_CB_LIST_END; |
392 } | 391 } |