Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/auth.c @ 29081:673ed3740cd7
Speilling!
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 07 Nov 2009 06:55:55 +0000 |
parents | f27ed49948b7 |
children | c1d41b7484ff |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15823 | 2 * purple - Jabber Protocol Plugin |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
28398
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
6 * source distribution. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19674
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 |
15891
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
25 #include "account.h" |
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
26 #include "debug.h" |
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
27 #include "cipher.h" |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
28 #include "core.h" |
15891
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
29 #include "conversation.h" |
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
30 #include "request.h" |
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
31 #include "sslconn.h" |
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
32 #include "util.h" |
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
33 #include "xmlnode.h" |
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
34 |
26542
680b54e417c1
Make the last one compile (add disco.h) and alphabetize.
Paul Aurich <paul@darkrain42.org>
parents:
26540
diff
changeset
|
35 #include "auth.h" |
680b54e417c1
Make the last one compile (add disco.h) and alphabetize.
Paul Aurich <paul@darkrain42.org>
parents:
26540
diff
changeset
|
36 #include "disco.h" |
680b54e417c1
Make the last one compile (add disco.h) and alphabetize.
Paul Aurich <paul@darkrain42.org>
parents:
26540
diff
changeset
|
37 #include "jabber.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "jutil.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "iq.h" |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
40 #include "notify.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
42 static GSList *auth_mechs = NULL; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
43 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
44 static void auth_old_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
45 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
46 xmlnode *packet, gpointer data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 jabber_process_starttls(JabberStream *js, xmlnode *packet) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 { |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
51 PurpleAccount *account; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 xmlnode *starttls; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
54 account = purple_connection_get_account(js->gc); |
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
55 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 if((starttls = xmlnode_get_child(packet, "starttls"))) { |
15823 | 57 if(purple_ssl_is_supported()) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 jabber_send_raw(js, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 } else if(xmlnode_get_child(starttls, "required")) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
62 purple_connection_error_reason(js->gc, |
21358 | 63 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, |
27460
6275df9d2d62
Change strings in libpurple/protocols/jabber/auth.c and util.c a little bit
Mark Doliner <mark@kingant.net>
parents:
27233
diff
changeset
|
64 _("Server requires TLS/SSL, but no TLS/SSL support was found.")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 return TRUE; |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
66 } else if(purple_account_get_bool(account, "require_tls", JABBER_DEFAULT_REQUIRE_TLS)) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
67 purple_connection_error_reason(js->gc, |
22776
abd261518b83
When an XMPP account is set to require TLS, but libpurple doesn't have SSL
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22655
diff
changeset
|
68 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, |
27460
6275df9d2d62
Change strings in libpurple/protocols/jabber/auth.c and util.c a little bit
Mark Doliner <mark@kingant.net>
parents:
27233
diff
changeset
|
69 _("You require encryption, but no TLS/SSL support was found.")); |
22776
abd261518b83
When an XMPP account is set to require TLS, but libpurple doesn't have SSL
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22655
diff
changeset
|
70 return TRUE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 static void finish_plaintext_authentication(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 { |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
79 JabberIq *iq; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
80 xmlnode *query, *x; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
82 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
83 query = xmlnode_get_child(iq->node, "query"); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
84 x = xmlnode_new_child(query, "username"); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
85 xmlnode_insert_data(x, js->user->node, -1); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
86 x = xmlnode_new_child(query, "resource"); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
87 xmlnode_insert_data(x, js->user->resource, -1); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
88 x = xmlnode_new_child(query, "password"); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
89 xmlnode_insert_data(x, purple_connection_get_password(js->gc), -1); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
90 jabber_iq_set_callback(iq, auth_old_result_cb, NULL); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
91 jabber_iq_send(iq); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
15823 | 94 static void allow_plaintext_auth(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 { |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
96 PurpleConnection *gc; |
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
97 JabberStream *js; |
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
98 |
15823 | 99 purple_account_set_bool(account, "auth_plain_in_clear", TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
101 gc = purple_account_get_connection(account); |
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
102 js = purple_connection_get_protocol_data(gc); |
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
103 |
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
104 finish_plaintext_authentication(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 |
15823 | 107 static void disallow_plaintext_auth(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 { |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
109 purple_connection_error_reason(purple_account_get_connection(account), |
21358 | 110 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
19999
diff
changeset
|
111 _("Server requires plaintext authentication over an unencrypted stream")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
114 static void |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
115 auth_old_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 { |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
117 PurpleAccount *account; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
118 JabberStream *js; |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
119 const char *entry; |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
120 gboolean remember; |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
121 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
122 /* The password prompt dialog doesn't get disposed if the account disconnects */ |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
123 if (!PURPLE_CONNECTION_IS_VALID(gc)) |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
124 return; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
125 |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
126 account = purple_connection_get_account(gc); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
127 js = purple_connection_get_protocol_data(gc); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
128 |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
129 entry = purple_request_fields_get_string(fields, "password"); |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
130 remember = purple_request_fields_get_bool(fields, "remember"); |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
131 |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
132 if (!entry || !*entry) |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
133 { |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
134 purple_notify_error(account, NULL, _("Password is required to sign on."), NULL); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
135 return; |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
136 } |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
137 |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
138 if (remember) |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
139 purple_account_set_remember_password(account, TRUE); |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
140 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
141 purple_account_set_password(account, entry); |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
142 |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
143 /* Restart our connection */ |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
144 jabber_auth_start_old(js); |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
145 } |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
146 |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
147 static void |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
148 auth_no_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
149 { |
19674
55c47f7ab2a2
The cyrus SASL password prompt dialogs don't get disposed if the account disconnects. This fixes the callbacks not to assume that the connection is still valid.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19197
diff
changeset
|
150 /* The password prompt dialog doesn't get disposed if the account disconnects */ |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
151 if (!PURPLE_CONNECTION_IS_VALID(gc)) |
19674
55c47f7ab2a2
The cyrus SASL password prompt dialogs don't get disposed if the account disconnects. This fixes the callbacks not to assume that the connection is still valid.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19197
diff
changeset
|
152 return; |
55c47f7ab2a2
The cyrus SASL password prompt dialogs don't get disposed if the account disconnects. This fixes the callbacks not to assume that the connection is still valid.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19197
diff
changeset
|
153 |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
154 /* Disable the account as the user has canceled connecting */ |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
155 purple_account_set_enabled(purple_connection_get_account(gc), purple_core_get_ui(), FALSE); |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
156 } |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
157 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 jabber_auth_start(JabberStream *js, xmlnode *packet) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 { |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
161 GSList *mechanisms = NULL; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
162 GSList *l; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
163 xmlnode *response; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 xmlnode *mechs, *mechnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 if(js->registration) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 jabber_register_start(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 mechs = xmlnode_get_child(packet, "mechanisms"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 if(!mechs) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
173 purple_connection_error_reason(js->gc, |
21358 | 174 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
175 _("Invalid response from server")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 for(mechnode = xmlnode_get_child(mechs, "mechanism"); mechnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 mechnode = xmlnode_get_next_twin(mechnode)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 char *mech_name = xmlnode_get_data(mechnode); |
23077
9d331ad0a8dc
Skip the X-GOOGLE-TOKEN mech (given us by Google Talk when connecting with
Evan Schoenberg <evan.s@dreskin.net>
parents:
22795
diff
changeset
|
183 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
184 if (mech_name && *mech_name) |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
185 mechanisms = g_slist_prepend(mechanisms, mech_name); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
186 else if (mech_name) |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
187 g_free(mech_name); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
188 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
191 for (l = auth_mechs; l; l = l->next) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
192 JabberSaslMech *possible = l->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
194 /* Is this the Cyrus SASL mechanism? */ |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
195 if (g_str_equal(possible->name, "*")) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
196 js->auth_mech = possible; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
197 break; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
198 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
200 /* Can we find this mechanism in the server's list? */ |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
201 if (g_slist_find_custom(mechanisms, possible->name, (GCompareFunc)strcmp)) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
202 js->auth_mech = possible; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
203 break; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
204 } |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
205 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
207 if (js->auth_mech == NULL) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
208 /* Found no good mechanisms... */ |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
209 purple_connection_error_reason(js->gc, |
21358 | 210 PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 _("Server does not use any supported authentication method")); |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
212 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 } |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
214 |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
215 response = js->auth_mech->start(js, mechs); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
216 if (response) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
217 jabber_send(js, response); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
218 xmlnode_free(response); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
219 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
222 static void auth_old_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
223 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
224 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 { |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
226 if (type == JABBER_IQ_RESULT) { |
28447
b357216b7b79
jabber: Fix using BOSH and legacy auth together. Closes #9990.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
227 jabber_stream_set_state(js, JABBER_STREAM_POST_AUTH); |
26540
f25410b0827c
Fix login process for older servers using IQ-auth.
Paul Aurich <paul@darkrain42.org>
parents:
26354
diff
changeset
|
228 jabber_disco_items_server(js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 } else { |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
230 PurpleAccount *account; |
21358 | 231 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
232 char *msg = jabber_parse_error(js, packet, &reason); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 xmlnode *error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 const char *err_code; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 |
29081 | 236 account = purple_connection_get_account(js->gc); |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
237 |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
238 /* FIXME: Why is this not in jabber_parse_error? */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 if((error = xmlnode_get_child(packet, "error")) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 (err_code = xmlnode_get_attrib(error, "code")) && |
28890
5328e205d3fb
jabber: Use purple_strequal to simplify some auth code
Paul Aurich <paul@darkrain42.org>
parents:
28889
diff
changeset
|
241 g_str_equal(err_code, "401")) { |
21358 | 242 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
19999
da29f5c7dc1a
Clear the password when we get an auth. error and we're not saving passwords so that you don't need to go into the account settings to reset it. Fix #3083.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19680
diff
changeset
|
243 /* Clear the pasword if it isn't being saved */ |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
244 if (!purple_account_get_remember_password(account)) |
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
245 purple_account_set_password(account, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
248 purple_connection_error_reason(js->gc, reason, msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
253 static void auth_old_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
254 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
255 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 xmlnode *query, *x; |
15823 | 259 const char *pw = purple_connection_get_password(js->gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
261 if (type == JABBER_IQ_ERROR) { |
21358 | 262 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20792
diff
changeset
|
263 char *msg = jabber_parse_error(js, packet, &reason); |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
264 purple_connection_error_reason(js->gc, reason, msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 g_free(msg); |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
266 } else if (type == JABBER_IQ_RESULT) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 query = xmlnode_get_child(packet, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 if(js->stream_id && xmlnode_get_child(query, "digest")) { |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24511
diff
changeset
|
269 char *s, *hash; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 x = xmlnode_new_child(query, "username"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 xmlnode_insert_data(x, js->user->node, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 x = xmlnode_new_child(query, "resource"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 xmlnode_insert_data(x, js->user->resource, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 x = xmlnode_new_child(query, "digest"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 s = g_strdup_printf("%s%s", js->stream_id, pw); |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24511
diff
changeset
|
280 hash = jabber_calculate_data_sha1sum(s, strlen(s)); |
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24511
diff
changeset
|
281 xmlnode_insert_data(x, hash, -1); |
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24511
diff
changeset
|
282 g_free(hash); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 g_free(s); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 jabber_iq_set_callback(iq, auth_old_result_cb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 |
23266
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
287 } else if(js->stream_id && (x = xmlnode_get_child(query, "crammd5"))) { |
21854
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
288 const char *challenge; |
23266
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
289 gchar digest[33]; |
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
290 PurpleCipherContext *hmac; |
21854
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
291 |
23266
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
292 /* Calculate the MHAC-MD5 digest */ |
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
293 challenge = xmlnode_get_attrib(x, "challenge"); |
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
294 hmac = purple_cipher_context_new_by_name("hmac", NULL); |
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
295 purple_cipher_context_set_option(hmac, "hash", "md5"); |
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
296 purple_cipher_context_set_key(hmac, (guchar *)pw); |
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
297 purple_cipher_context_append(hmac, (guchar *)challenge, strlen(challenge)); |
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
298 purple_cipher_context_digest_to_str(hmac, 33, digest, NULL); |
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
299 purple_cipher_context_destroy(hmac); |
21856
2e899bbbf14c
Last minute 'cleanup' actually resulted in breakage on my cram-md5 commit. Fixed it.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21854
diff
changeset
|
300 |
2e899bbbf14c
Last minute 'cleanup' actually resulted in breakage on my cram-md5 commit. Fixed it.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21854
diff
changeset
|
301 /* Create the response query */ |
21854
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
302 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
303 query = xmlnode_get_child(iq->node, "query"); |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
304 |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
305 x = xmlnode_new_child(query, "username"); |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
306 xmlnode_insert_data(x, js->user->node, -1); |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
307 x = xmlnode_new_child(query, "resource"); |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
308 xmlnode_insert_data(x, js->user->resource, -1); |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
309 |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
310 x = xmlnode_new_child(query, "crammd5"); |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
311 |
23266
2b997b690500
A patch from QuLogic to eliminate duplicated HMAC-MD5 code in the Jabber
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23258
diff
changeset
|
312 xmlnode_insert_data(x, digest, 32); |
21854
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
313 |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
314 jabber_iq_set_callback(iq, auth_old_result_cb, NULL); |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
315 jabber_iq_send(iq); |
cb715de60eb2
Added support for authentication via CRAM-MD5 when using jabber:iq:auth.
Evan Schoenberg <evan.s@dreskin.net>
parents:
21853
diff
changeset
|
316 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 } else if(xmlnode_get_child(query, "password")) { |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
318 PurpleAccount *account = purple_connection_get_account(js->gc); |
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
319 if(!jabber_stream_is_ssl(js) && !purple_account_get_bool(account, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 "auth_plain_in_clear", FALSE)) { |
22655
fa7e07c74a59
The warning string for plaintext auth over an unencrypted connection is found
Evan Schoenberg <evan.s@dreskin.net>
parents:
22642
diff
changeset
|
321 char *msg = g_strdup_printf(_("%s requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?"), |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
322 purple_account_get_username(account)); |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
323 purple_request_yes_no(js->gc, _("Plaintext Authentication"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 _("Plaintext Authentication"), |
22655
fa7e07c74a59
The warning string for plaintext auth over an unencrypted connection is found
Evan Schoenberg <evan.s@dreskin.net>
parents:
22642
diff
changeset
|
325 msg, |
22143
70fc60344317
A few more of those "default_action" fixes
Mark Doliner <mark@kingant.net>
parents:
21949
diff
changeset
|
326 1, |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
327 account, NULL, NULL, |
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
328 account, allow_plaintext_auth, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
329 disallow_plaintext_auth); |
22655
fa7e07c74a59
The warning string for plaintext auth over an unencrypted connection is found
Evan Schoenberg <evan.s@dreskin.net>
parents:
22642
diff
changeset
|
330 g_free(msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 finish_plaintext_authentication(js); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 } else { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
335 purple_connection_error_reason(js->gc, |
21358 | 336 PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, |
20117
f24a2cacacd1
Use PurpleDisconnectReasons in prpl-jabber.
Will Thompson <will.thompson@collabora.co.uk>
parents:
19999
diff
changeset
|
337 _("Server does not use any supported authentication method")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 void jabber_auth_start_old(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 { |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
345 PurpleAccount *account; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 xmlnode *query, *username; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
349 account = purple_connection_get_account(js->gc); |
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
350 |
28658
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
351 /* |
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
352 * We can end up here without encryption if the server doesn't support |
27029
131e41a24d95
Require SSL when trying IQ-auth via parser.c (no stream:features). Fixes #8131.
Paul Aurich <paul@darkrain42.org>
parents:
26569
diff
changeset
|
353 * <stream:features/> and we're not using old-style SSL. If the user |
131e41a24d95
Require SSL when trying IQ-auth via parser.c (no stream:features). Fixes #8131.
Paul Aurich <paul@darkrain42.org>
parents:
26569
diff
changeset
|
354 * is requiring SSL/TLS, we need to enforce it. |
131e41a24d95
Require SSL when trying IQ-auth via parser.c (no stream:features). Fixes #8131.
Paul Aurich <paul@darkrain42.org>
parents:
26569
diff
changeset
|
355 */ |
131e41a24d95
Require SSL when trying IQ-auth via parser.c (no stream:features). Fixes #8131.
Paul Aurich <paul@darkrain42.org>
parents:
26569
diff
changeset
|
356 if (!jabber_stream_is_ssl(js) && |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
357 purple_account_get_bool(account, "require_tls", JABBER_DEFAULT_REQUIRE_TLS)) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
358 purple_connection_error_reason(js->gc, |
27029
131e41a24d95
Require SSL when trying IQ-auth via parser.c (no stream:features). Fixes #8131.
Paul Aurich <paul@darkrain42.org>
parents:
26569
diff
changeset
|
359 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
131e41a24d95
Require SSL when trying IQ-auth via parser.c (no stream:features). Fixes #8131.
Paul Aurich <paul@darkrain42.org>
parents:
26569
diff
changeset
|
360 _("You require encryption, but it is not available on this server.")); |
131e41a24d95
Require SSL when trying IQ-auth via parser.c (no stream:features). Fixes #8131.
Paul Aurich <paul@darkrain42.org>
parents:
26569
diff
changeset
|
361 return; |
131e41a24d95
Require SSL when trying IQ-auth via parser.c (no stream:features). Fixes #8131.
Paul Aurich <paul@darkrain42.org>
parents:
26569
diff
changeset
|
362 } |
131e41a24d95
Require SSL when trying IQ-auth via parser.c (no stream:features). Fixes #8131.
Paul Aurich <paul@darkrain42.org>
parents:
26569
diff
changeset
|
363 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
364 if (js->registration) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
365 jabber_register_start(js); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
366 return; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
367 } |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
368 |
28658
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
369 /* |
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
370 * IQ Auth doesn't have support for resource binding, so we need to pick a |
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
371 * default resource so it will work properly. jabberd14 throws an error and |
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
372 * iChat server just fails silently. |
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
373 */ |
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
374 if (!js->user->resource || *js->user->resource == '\0') { |
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
375 g_free(js->user->resource); |
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
376 js->user->resource = g_strdup("Home"); |
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
377 } |
fa77b70c8ca6
jabber: Always require a resource when starting Legacy IQ Auth.
Paul Aurich <paul@darkrain42.org>
parents:
28447
diff
changeset
|
378 |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
379 #ifdef HAVE_CYRUS_SASL |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
380 /* If we have Cyrus SASL, then passwords will have been set |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
381 * to OPTIONAL for this protocol. So, we need to do our own |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
382 * password prompting here |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
383 */ |
20152
0cb113dfb096
Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19999
diff
changeset
|
384 |
29079
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
385 if (!purple_account_get_password(account)) { |
de8565bc63fe
jabber: Use accessors instead of directly accessing gc->account (and similar)
Paul Aurich <paul@darkrain42.org>
parents:
29078
diff
changeset
|
386 purple_account_request_password(account, G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc); |
16068
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
387 return; |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
388 } |
ac1a32ebd62c
patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
389 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:auth"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 username = xmlnode_new_child(query, "username"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 xmlnode_insert_data(username, js->user->node, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 jabber_iq_set_callback(iq, auth_old_cb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 const char *ns = xmlnode_get_namespace(packet); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 |
28890
5328e205d3fb
jabber: Use purple_strequal to simplify some auth code
Paul Aurich <paul@darkrain42.org>
parents:
28889
diff
changeset
|
406 if (!purple_strequal(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
407 purple_connection_error_reason(js->gc, |
21358 | 408 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
409 _("Invalid response from server")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
413 if (js->auth_mech && js->auth_mech->handle_challenge) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
414 xmlnode *response = js->auth_mech->handle_challenge(js, packet); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
415 if (response != NULL) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
416 jabber_send(js, response); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
417 xmlnode_free(response); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
418 } |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
419 } else |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
420 purple_debug_warning("jabber", "Received unexpected (and unhandled) <challenge/>\n"); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
421 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
423 void jabber_auth_handle_success(JabberStream *js, xmlnode *packet) |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
424 { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
425 const char *ns = xmlnode_get_namespace(packet); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
427 if (!purple_strequal(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
428 purple_connection_error_reason(js->gc, |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
429 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
430 _("Invalid response from server")); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
431 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 } |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
433 |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
434 if (js->auth_mech && js->auth_mech->handle_success && |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
435 !js->auth_mech->handle_success(js, packet)) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
436 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 |
28447
b357216b7b79
jabber: Fix using BOSH and legacy auth together. Closes #9990.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
439 /* |
b357216b7b79
jabber: Fix using BOSH and legacy auth together. Closes #9990.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
440 * The stream will be reinitialized later in jabber_recv_cb_ssl() or |
b357216b7b79
jabber: Fix using BOSH and legacy auth together. Closes #9990.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
441 * jabber_bosh_connection_send. |
b357216b7b79
jabber: Fix using BOSH and legacy auth together. Closes #9990.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
442 */ |
b357216b7b79
jabber: Fix using BOSH and legacy auth together. Closes #9990.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
443 js->reinit = TRUE; |
b357216b7b79
jabber: Fix using BOSH and legacy auth together. Closes #9990.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
444 jabber_stream_set_state(js, JABBER_STREAM_POST_AUTH); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 { |
21358 | 449 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
22640
23fe481afccf
The next version of RFC 3920, the draft of which can be found at http://www.xmpp.org/internet-drafts/draft-saintandre-rfc3920bis-04.html, and subsequent email clarifications with Peter Saint-Andre and Alexey Melnikov indicate that we should be trying the next mechanism in line after one mechanism fails. We should also be ensuring that the mech list is sorted in order of descending security, which we don't do yet; however, servers are supposed to send us a sorted list, as well, so this isn't a major issue.
Stu Tomlinson <stu@nosnilmot.com>
parents:
22515
diff
changeset
|
450 char *msg; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
452 if (js->auth_mech && js->auth_mech->handle_failure) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
453 xmlnode *stanza = js->auth_mech->handle_failure(js, packet); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
454 if (stanza) { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
455 jabber_send(js, stanza); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
456 xmlnode_free(stanza); |
22750
d5b3afea8764
After trying the available SASL mechs, jabber_auth_handle_failure() now
Evan Schoenberg <evan.s@dreskin.net>
parents:
22655
diff
changeset
|
457 return; |
d5b3afea8764
After trying the available SASL mechs, jabber_auth_handle_failure() now
Evan Schoenberg <evan.s@dreskin.net>
parents:
22655
diff
changeset
|
458 } |
22640
23fe481afccf
The next version of RFC 3920, the draft of which can be found at http://www.xmpp.org/internet-drafts/draft-saintandre-rfc3920bis-04.html, and subsequent email clarifications with Peter Saint-Andre and Alexey Melnikov indicate that we should be trying the next mechanism in line after one mechanism fails. We should also be ensuring that the mech list is sorted in order of descending security, which we don't do yet; however, servers are supposed to send us a sorted list, as well, so this isn't a major issue.
Stu Tomlinson <stu@nosnilmot.com>
parents:
22515
diff
changeset
|
459 } |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
460 |
22640
23fe481afccf
The next version of RFC 3920, the draft of which can be found at http://www.xmpp.org/internet-drafts/draft-saintandre-rfc3920bis-04.html, and subsequent email clarifications with Peter Saint-Andre and Alexey Melnikov indicate that we should be trying the next mechanism in line after one mechanism fails. We should also be ensuring that the mech list is sorted in order of descending security, which we don't do yet; however, servers are supposed to send us a sorted list, as well, so this isn't a major issue.
Stu Tomlinson <stu@nosnilmot.com>
parents:
22515
diff
changeset
|
461 msg = jabber_parse_error(js, packet, &reason); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 if(!msg) { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
463 purple_connection_error_reason(js->gc, |
21358 | 464 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
465 _("Invalid response from server")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 } else { |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27461
diff
changeset
|
467 purple_connection_error_reason(js->gc, reason, msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 } |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
471 |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
472 static gint compare_mech(gconstpointer a, gconstpointer b) |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
473 { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
474 const JabberSaslMech *mech_a = a; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
475 const JabberSaslMech *mech_b = b; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
476 |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
477 /* higher priority comes *before* lower priority in the list */ |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
478 if (mech_a->priority > mech_b->priority) |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
479 return -1; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
480 else if (mech_a->priority < mech_b->priority) |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
481 return 1; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
482 /* This really shouldn't happen */ |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
483 return 0; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
484 } |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
485 |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
486 void jabber_auth_init(void) |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
487 { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
488 auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_plain_mech(), compare_mech); |
29080
f27ed49948b7
jabber: Oops, re-enable DIGEST-MD5 (I was testing PLAIN).
Paul Aurich <paul@darkrain42.org>
parents:
29079
diff
changeset
|
489 auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_digest_md5_mech(), compare_mech); |
29078
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
490 #ifdef HAVE_CYRUS_SASL |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
491 auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_cyrus_mech(), compare_mech); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
492 #endif |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
493 } |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
494 |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
495 void jabber_auth_uninit(void) |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
496 { |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
497 g_slist_free(auth_mechs); |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
498 auth_mechs = NULL; |
8ada06fb65ed
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <paul@darkrain42.org>
parents:
28896
diff
changeset
|
499 } |