grim/pidgin

Implmeth WEBEX-TOKEN SASL auth for jabber.
auth-webex
2016-07-14, Bryon Roche
d90489886f13
Parents 1cf07b94c6ca
Children f69d1758aaa3
Implmeth WEBEX-TOKEN SASL auth for jabber.
--- a/configure.ac Thu Jul 07 23:39:50 2016 -0500
+++ b/configure.ac Thu Jul 14 15:54:35 2016 -0700
@@ -2044,6 +2044,18 @@
fi
dnl #######################################################################
+dnl # Check if we want webex token support for XMPP
+dnl #######################################################################
+dnl AC_CHECK_SIZEOF(short)
+AC_ARG_ENABLE(webex-token, AC_HELP_STRING([--enable-webex-token], [enable WebEx Token SASL for xmpp/irc]), enable_webex_token=$enableval, enable_webex_token=no)
+if test "x$enable_webex_token" = "xyes" ; then
+ AM_CONDITIONAL(USE_WEBEX_TOKEN, true)
+ AC_DEFINE(HAVE_WEBEX_TOKEN, [1], [Define to 1 if building WebEx Token support])
+else
+ AM_CONDITIONAL(USE_WEBEX_TOKEN, false)
+fi
+
+dnl #######################################################################
dnl # Check for Kerberos (for Zephyr)
dnl #######################################################################
AC_DEFINE(ZEPHYR_INT32, long, [Size of an int32.])
--- a/libpurple/protocols/jabber/Makefile.am Thu Jul 07 23:39:50 2016 -0500
+++ b/libpurple/protocols/jabber/Makefile.am Thu Jul 14 15:54:35 2016 -0700
@@ -109,6 +109,10 @@
JABBERSOURCES += win32/posix.uname.c
endif
+if USE_WEBEX_TOKEN
+JABBERSOURCES += auth_webex.c
+endif
+
if STATIC_JABBER
st = -DPURPLE_STATIC_PRPL
--- a/libpurple/protocols/jabber/auth.c Thu Jul 07 23:39:50 2016 -0500
+++ b/libpurple/protocols/jabber/auth.c Thu Jul 14 15:54:35 2016 -0700
@@ -529,6 +529,9 @@
#ifdef HAVE_CYRUS_SASL
jabber_auth_add_mech(jabber_auth_get_cyrus_mech());
#endif
+#ifdef HAVE_WEBEX_TOKEN
+ jabber_auth_add_mech(jabber_auth_get_webex_token_mech());
+#endif
tmp = jabber_auth_get_scram_mechs(&count);
for (i = 0; i < count; ++i)
--- a/libpurple/protocols/jabber/auth.h Thu Jul 07 23:39:50 2016 -0500
+++ b/libpurple/protocols/jabber/auth.h Thu Jul 14 15:54:35 2016 -0700
@@ -57,6 +57,9 @@
#ifdef HAVE_CYRUS_SASL
JabberSaslMech *jabber_auth_get_cyrus_mech(void);
#endif
+#ifdef HAVE_WEBEX_TOKEN
+JabberSaslMech *jabber_auth_get_webex_token_mech(void);
+#endif
void jabber_auth_add_mech(JabberSaslMech *);
void jabber_auth_remove_mech(JabberSaslMech *);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/jabber/auth_webex.c Thu Jul 14 15:54:35 2016 -0700
@@ -0,0 +1,70 @@
+/*
+ * purple - Jabber Protocol Plugin
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ *
+ */
+#include "internal.h"
+
+#include "account.h"
+#include "debug.h"
+#include "request.h"
+#include "util.h"
+#include "xmlnode.h"
+
+#include "jabber.h"
+#include "auth.h"
+
+static xmlnode *finish_webex_authentication(JabberStream *js)
+{
+ xmlnode *auth;
+
+ auth = xmlnode_new("auth");
+ xmlnode_set_namespace(auth, NS_XMPP_SASL);
+
+ xmlnode_set_attrib(auth, "xmlns:ga", "http://www.google.com/talk/protocol/auth");
+ xmlnode_set_attrib(auth, "ga:client-uses-full-bind-result", "true");
+
+ xmlnode_set_attrib(auth, "mechanism", "WEBEX-TOKEN");
+ xmlnode_insert_data(auth, purple_connection_get_password(js->gc), -1);
+
+ return auth;
+}
+
+static JabberSaslState
+jabber_webex_start(JabberStream *js, xmlnode *packet, xmlnode **response, char **error)
+{
+ *response = finish_webex_authentication(js);
+ return JABBER_SASL_STATE_OK;
+}
+
+static JabberSaslMech webex_token_mech = {
+ 101, /* priority */
+ "WEBEX-TOKEN", /* name */
+ jabber_webex_start,
+ NULL, /* handle_challenge */
+ NULL, /* handle_success */
+ NULL, /* handle_failure */
+ NULL /* dispose */
+};
+
+JabberSaslMech *jabber_auth_get_webex_token_mech(void)
+{
+ return &webex_token_mech;
+}