libpurple/protocols/jabber/auth.h

Sat, 13 Mar 2021 15:33:49 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 13 Mar 2021 15:33:49 -0600
changeset 40818
3891ef6e3b56
parent 40358
e6fe6fc1f516
child 41488
95f59c2bc50d
permissions
-rw-r--r--

Fix building on glib < 2.58.0 as we have a minimum of 2.52.0

Add compatibility for G_SOURCE_FUNC and g_time_zone_new_offset that were added in 2.58.0

g_time_zone_new_offset is from 2.58.0 which might be buggy, the version of it
from glib git has some fixes it but it is much more involved so using the older
version is a calculated risk.

Testing Done:
Built on ubuntu:bionic.

Reviewed at https://reviews.imfreedom.org/r/573/

7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /**
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * @file auth.h Authentication routines
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
4 * purple
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 *
28322
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26703
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26703
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26703
diff changeset
8 * source distribution.
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * (at your option) any later version.
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * GNU General Public License for more details.
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 15884
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23 */
39819
3554dac2991b Standardize all protocol header guard macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39069
diff changeset
24
3554dac2991b Standardize all protocol header guard macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39069
diff changeset
25 #ifndef PURPLE_JABBER_AUTH_H
3554dac2991b Standardize all protocol header guard macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39069
diff changeset
26 #define PURPLE_JABBER_AUTH_H
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27
28855
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
28 typedef struct _JabberSaslMech JabberSaslMech;
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
29
40358
e6fe6fc1f516 move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents: 39819
diff changeset
30 #include <purple.h>
e6fe6fc1f516 move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents: 39819
diff changeset
31
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
32 #include "jabber.h"
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
33
29084
3a821d391ac0 Let's try a more complex set of return states / values for auth mechs.
Paul Aurich <darkrain42@pidgin.im>
parents: 28866
diff changeset
34 typedef enum {
3a821d391ac0 Let's try a more complex set of return states / values for auth mechs.
Paul Aurich <darkrain42@pidgin.im>
parents: 28866
diff changeset
35 JABBER_SASL_STATE_FAIL = -1, /* Abort, Retry, Fail? */
3a821d391ac0 Let's try a more complex set of return states / values for auth mechs.
Paul Aurich <darkrain42@pidgin.im>
parents: 28866
diff changeset
36 JABBER_SASL_STATE_OK = 0, /* Hooray! */
3a821d391ac0 Let's try a more complex set of return states / values for auth mechs.
Paul Aurich <darkrain42@pidgin.im>
parents: 28866
diff changeset
37 JABBER_SASL_STATE_CONTINUE = 1 /* More authentication required */
3a821d391ac0 Let's try a more complex set of return states / values for auth mechs.
Paul Aurich <darkrain42@pidgin.im>
parents: 28866
diff changeset
38 } JabberSaslState;
3a821d391ac0 Let's try a more complex set of return states / values for auth mechs.
Paul Aurich <darkrain42@pidgin.im>
parents: 28866
diff changeset
39
28855
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
40 struct _JabberSaslMech {
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
41 gint8 priority; /* Higher priority will be tried before lower priority */
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
42 const gchar *name;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 30898
diff changeset
43 JabberSaslState (*start)(JabberStream *js, PurpleXmlNode *mechanisms, PurpleXmlNode **reply, char **msg);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 30898
diff changeset
44 JabberSaslState (*handle_challenge)(JabberStream *js, PurpleXmlNode *packet, PurpleXmlNode **reply, char **msg);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 30898
diff changeset
45 JabberSaslState (*handle_success)(JabberStream *js, PurpleXmlNode *packet, char **msg);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 30898
diff changeset
46 JabberSaslState (*handle_failure)(JabberStream *js, PurpleXmlNode *packet, PurpleXmlNode **reply, char **msg);
28855
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
47 void (*dispose)(JabberStream *js);
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
48 };
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
49
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 30898
diff changeset
50 void jabber_auth_start(JabberStream *js, PurpleXmlNode *packet);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51 void jabber_auth_start_old(JabberStream *js);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 30898
diff changeset
52 void jabber_auth_handle_challenge(JabberStream *js, PurpleXmlNode *packet);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 30898
diff changeset
53 void jabber_auth_handle_success(JabberStream *js, PurpleXmlNode *packet);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 30898
diff changeset
54 void jabber_auth_handle_failure(JabberStream *js, PurpleXmlNode *packet);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
55
28855
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
56 JabberSaslMech *jabber_auth_get_plain_mech(void);
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
57 JabberSaslMech *jabber_auth_get_digest_md5_mech(void);
28866
e3d867ce000b jabber: Complete (though untested) SCRAM implementation.
Paul Aurich <darkrain42@pidgin.im>
parents: 28855
diff changeset
58 JabberSaslMech **jabber_auth_get_scram_mechs(gint *count);
28855
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
59 #ifdef HAVE_CYRUS_SASL
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
60 JabberSaslMech *jabber_auth_get_cyrus_mech(void);
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
61 #endif
39067
d90489886f13 Implmeth WEBEX-TOKEN SASL auth for jabber.
Bryon Roche <kain@kain.org>
parents: 34935
diff changeset
62 JabberSaslMech *jabber_auth_get_webex_token_mech(void);
28855
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
63
30898
f7c884a1c8ff jabber: Add abstraction functions for adding/removing auth mechs. Closes #12715
Eion Robb <eion@robbmob.com>
parents: 30156
diff changeset
64 void jabber_auth_add_mech(JabberSaslMech *);
f7c884a1c8ff jabber: Add abstraction functions for adding/removing auth mechs. Closes #12715
Eion Robb <eion@robbmob.com>
parents: 30156
diff changeset
65 void jabber_auth_remove_mech(JabberSaslMech *);
f7c884a1c8ff jabber: Add abstraction functions for adding/removing auth mechs. Closes #12715
Eion Robb <eion@robbmob.com>
parents: 30156
diff changeset
66
28855
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
67 void jabber_auth_init(void);
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
68 void jabber_auth_uninit(void);
c5bc85f9c00e jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
69
39819
3554dac2991b Standardize all protocol header guard macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39069
diff changeset
70 #endif /* PURPLE_JABBER_AUTH_H */

mercurial