r14555 - in /packages/unstable/loudmouth/debian: changelog patches/ patches/00_xmpp_with_old_style_auth.patch

sjoerd at users.alioth.debian.org sjoerd at users.alioth.debian.org
Wed Feb 13 10:18:47 UTC 2008


Author: sjoerd
Date: Wed Feb 13 10:18:47 2008
New Revision: 14555

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=14555
Log:
* debian/paches/00_xmpp_with_old_style_auth.patch
  - Add support for using obsolete XEP-0078 authentication with XMPP 1.0
    servers that don't implement SASL

Added:
    packages/unstable/loudmouth/debian/patches/
    packages/unstable/loudmouth/debian/patches/00_xmpp_with_old_style_auth.patch
Modified:
    packages/unstable/loudmouth/debian/changelog

Modified: packages/unstable/loudmouth/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/loudmouth/debian/changelog?rev=14555&op=diff
==============================================================================
--- packages/unstable/loudmouth/debian/changelog (original)
+++ packages/unstable/loudmouth/debian/changelog Wed Feb 13 10:18:47 2008
@@ -1,3 +1,11 @@
+loudmouth (1.3.3-2) UNRELEASED; urgency=low
+
+  * debian/paches/00_xmpp_with_old_style_auth.patch
+    - Add support for using obsolete XEP-0078 authentication with XMPP 1.0
+      servers that don't implement SASL
+
+ -- Sjoerd Simons <sjoerd at debian.org>  Wed, 13 Feb 2008 11:16:01 +0100
+
 loudmouth (1.3.3-1) unstable; urgency=low
 
   * New upstream release

Added: packages/unstable/loudmouth/debian/patches/00_xmpp_with_old_style_auth.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/loudmouth/debian/patches/00_xmpp_with_old_style_auth.patch?rev=14555&op=file
==============================================================================
--- packages/unstable/loudmouth/debian/patches/00_xmpp_with_old_style_auth.patch (added)
+++ packages/unstable/loudmouth/debian/patches/00_xmpp_with_old_style_auth.patch Wed Feb 13 10:18:47 2008
@@ -1,0 +1,162 @@
+From: Senko Rasic <senko at phyrexia.lan>
+Date: Wed, 13 Feb 2008 00:15:21 +0000 (+0100)
+Subject: Support obsolete XEP-0078 (old-style jabber auth for XMPP1.0).
+X-Git-Url: http://gitweb.freedesktop.org/?p=users/senko/loudmouth.git;a=commitdiff;h=574a9fad349b9bb85775b0cf477099a8cc4b5bcc
+
+Support obsolete XEP-0078 (old-style jabber auth for XMPP1.0).
+---
+
+--- a/loudmouth/lm-connection.c
++++ b/loudmouth/lm-connection.c
+@@ -73,7 +73,7 @@ struct _LmConnection {
+ 	GSList       *handlers[LM_MESSAGE_TYPE_UNKNOWN];
+ 
+ 	/* XMPP1.0 stuff (SASL, resource binding, StartTLS) */
+-	gboolean      use_xmpp;
++	gboolean      use_sasl;
+ 	LmSASL       *sasl;
+ 	gchar        *resource;
+ 	LmMessageHandler *features_cb;
+@@ -727,7 +727,7 @@ connection_stream_received (LmConnection
+ 		lm_verbose ("XMPP 1.0 stream received: %s\n",
+ 			    connection->stream_id);
+ 
+-		connection->use_xmpp = TRUE;
++		connection->use_sasl = TRUE;
+ 		
+ 		/* stream is started multiple times, but we only want
+ 		 * one sasl mechanism */
+@@ -1029,6 +1029,7 @@ connection_features_cb (LmMessageHandler
+ {
+ 	LmMessageNode *bind_node;
+ 	LmMessageNode    *starttls_node;
++	LmMessageNode *old_auth;
+ 	
+ 	starttls_node = lm_message_node_find_child (message->node, "starttls");
+ 	if (connection->ssl && lm_ssl_get_use_starttls (connection->ssl)) {
+@@ -1097,6 +1098,33 @@ connection_features_cb (LmMessageHandler
+ 		}
+ 	}
+ 
++	old_auth = lm_message_node_find_child (message->node, "auth");
++	if (connection->use_sasl && old_auth) {
++		g_debug ("Server uses XEP-0078 (jabber iq auth) instead of SASL");
++		/* So the server is XMPP1.0, but doesn't support SASL and uses
++		 * obsolete XEP-0078 instead. Let's cope. */
++
++		connection->use_sasl = FALSE;
++
++		if (connection->sasl) {
++			const gchar *user, *pass;
++
++			lm_sasl_get_auth_params (connection->sasl, &user, &pass);
++			if (user && pass) {
++				GError *error = NULL;
++				_lm_connection_old_auth (connection, user, pass,
++					connection->resource, &error);
++
++				if (error)
++					g_error_free (error);
++
++			}
++
++			lm_sasl_free (connection->sasl);
++			connection->sasl = NULL;
++		}
++	}
++
+ 	return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+ }
+ 
+@@ -1142,7 +1170,7 @@ lm_connection_new (const gchar *server)
+ 	connection->keep_alive_source = NULL;
+ 	connection->keep_alive_rate   = 0;
+ 	connection->socket            = NULL;
+-	connection->use_xmpp          = FALSE;
++	connection->use_sasl          = FALSE;
+ 	connection->tls_started       = FALSE;
+ 	
+ 	connection->id_handlers = g_hash_table_new_full (g_str_hash, 
+@@ -1374,11 +1402,6 @@ lm_connection_authenticate (LmConnection
+ 			    GDestroyNotify     notify,
+ 			    GError           **error)
+ {
+-	LmMessage        *m;
+-	LmMessageHandler *handler;
+-	gboolean          result;
+-	AuthReqData      *data;
+-	
+ 	g_return_val_if_fail (connection != NULL, FALSE);
+ 	g_return_val_if_fail (username != NULL, FALSE);
+ 	g_return_val_if_fail (password != NULL, FALSE);
+@@ -1402,7 +1425,7 @@ lm_connection_authenticate (LmConnection
+ 	connection->effective_jid = g_strdup_printf ("%s/%s", 
+ 		connection->jid, connection->resource);
+ 
+-	if (connection->use_xmpp) {
++	if (connection->use_sasl) {
+ 		lm_sasl_authenticate (connection->sasl,
+ 				      username, password,
+ 				      connection->server,
+@@ -1419,6 +1442,20 @@ lm_connection_authenticate (LmConnection
+ 		return TRUE;
+ 	}
+ 
++	return _lm_connection_old_auth (connection, username, password,
++		resource, error);
++}
++
++gboolean
++_lm_connection_old_auth (LmConnection *connection, const gchar *username,
++	const gchar *password, const gchar *resource, GError **error)
++{
++	LmMessage        *m;
++	AuthReqData      *data;
++	LmMessageHandler *handler;
++	gboolean          result;
++	
++
+ 	m = connection_create_auth_req_msg (username);
+ 		
+ 	data = g_new0 (AuthReqData, 1);
+--- a/loudmouth/lm-connection.h
++++ b/loudmouth/lm-connection.h
+@@ -164,6 +164,11 @@ gchar *       lm_connection_get_local_ho
+ LmConnection* lm_connection_ref               (LmConnection       *connection);
+ void          lm_connection_unref             (LmConnection       *connection);
+ 
++gboolean
++_lm_connection_old_auth (LmConnection *connection, const gchar *username,
++			 const gchar *password, const gchar *resource,
++			 GError **errror);
++
+ 
+ G_END_DECLS
+ 
+--- a/loudmouth/lm-sasl.c
++++ b/loudmouth/lm-sasl.c
+@@ -834,3 +834,11 @@ lm_sasl_free (LmSASL *sasl)
+ }
+ 
+ 
++void
++lm_sasl_get_auth_params (LmSASL *sasl, const gchar **username,
++	const gchar **password)
++{
++	*username = sasl->username;
++	*password = sasl->password;
++}
++
+--- a/loudmouth/lm-sasl.h
++++ b/loudmouth/lm-sasl.h
+@@ -46,6 +46,10 @@ void lm_sasl_authenticate (LmSASL *sasl,
+ 
+ void lm_sasl_free (LmSASL *sasl);
+ 
++void
++lm_sasl_get_auth_params (LmSASL *sasl, const gchar **username,
++	const gchar **password);
++
+ G_END_DECLS
+ 
+ #endif /* __LM_SASL_H__ */




More information about the pkg-gnome-commits mailing list