changeset 28715:cea22db36ffc

jabber: Use NS_XMPP_SASL
author Paul Aurich <paul@darkrain42.org>
date Fri, 27 Nov 2009 20:41:22 +0000
parents d9c70a78fad5
children eb4081c68c57
files libpurple/protocols/jabber/auth.c libpurple/protocols/jabber/auth_cyrus.c libpurple/protocols/jabber/auth_digest_md5.c libpurple/protocols/jabber/auth_plain.c libpurple/protocols/jabber/auth_scram.c
diffstat 5 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/auth.c	Fri Nov 27 20:36:31 2009 +0000
+++ b/libpurple/protocols/jabber/auth.c	Fri Nov 27 20:41:22 2009 +0000
@@ -111,6 +111,7 @@
 		_("Server requires plaintext authentication over an unencrypted stream"));
 }
 
+#ifdef HAVE_CYRUS_SASL
 static void
 auth_old_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields)
 {
@@ -154,6 +155,7 @@
 	/* Disable the account as the user has canceled connecting */
 	purple_account_set_enabled(purple_connection_get_account(gc), purple_core_get_ui(), FALSE);
 }
+#endif
 
 void
 jabber_auth_start(JabberStream *js, xmlnode *packet)
@@ -403,7 +405,7 @@
 {
 	const char *ns = xmlnode_get_namespace(packet);
 
-	if (!purple_strequal(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
+	if (!purple_strequal(ns, NS_XMPP_SASL)) {
 		purple_connection_error_reason(js->gc,
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Invalid response from server"));
@@ -424,7 +426,7 @@
 {
 	const char *ns = xmlnode_get_namespace(packet);
 
-	if (!purple_strequal(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
+	if (!purple_strequal(ns, NS_XMPP_SASL)) {
 		purple_connection_error_reason(js->gc,
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Invalid response from server"));
--- a/libpurple/protocols/jabber/auth_cyrus.c	Fri Nov 27 20:36:31 2009 +0000
+++ b/libpurple/protocols/jabber/auth_cyrus.c	Fri Nov 27 20:41:22 2009 +0000
@@ -302,7 +302,7 @@
 
 	if (js->sasl_state == SASL_CONTINUE || js->sasl_state == SASL_OK) {
 		auth = xmlnode_new("auth");
-		xmlnode_set_namespace(auth, "urn:ietf:params:xml:ns:xmpp-sasl");
+		xmlnode_set_namespace(auth, NS_XMPP_SASL);
 		xmlnode_set_attrib(auth, "mechanism", js->current_mech);
 
 		xmlnode_set_attrib(auth, "xmlns:ga", "http://www.google.com/talk/protocol/auth");
@@ -439,7 +439,7 @@
 		g_free(tmp);
 	} else {
 		response = xmlnode_new("response");
-		xmlnode_set_namespace(response, "urn:ietf:params:xml:ns:xmpp-sasl");
+		xmlnode_set_namespace(response, NS_XMPP_SASL);
 		if (clen > 0) {
 			/* Cyrus SASL 2.1.22 appears to contain code to add the charset
 			 * to the response for DIGEST-MD5 but there is no possibility
--- a/libpurple/protocols/jabber/auth_digest_md5.c	Fri Nov 27 20:36:31 2009 +0000
+++ b/libpurple/protocols/jabber/auth_digest_md5.c	Fri Nov 27 20:41:22 2009 +0000
@@ -35,7 +35,7 @@
 	xmlnode *auth;
 
 	auth = xmlnode_new("auth");
-	xmlnode_set_namespace(auth, "urn:ietf:params:xml:ns:xmpp-sasl");
+	xmlnode_set_namespace(auth, NS_XMPP_SASL);
 	xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5");
 
 	return auth;
@@ -189,7 +189,7 @@
 
 		if (rspauth && purple_strequal(rspauth, js->expected_rspauth)) {
 			reply = xmlnode_new("response");
-			xmlnode_set_namespace(reply, "urn:ietf:params:xml:ns:xmpp-sasl");
+			xmlnode_set_namespace(reply, NS_XMPP_SASL);
 		} else {
 			purple_connection_error_reason(js->gc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
@@ -259,7 +259,7 @@
 					response->len, response->str);
 
 			reply = xmlnode_new("response");
-			xmlnode_set_namespace(reply, "urn:ietf:params:xml:ns:xmpp-sasl");
+			xmlnode_set_namespace(reply, NS_XMPP_SASL);
 			xmlnode_insert_data(reply, enc_out, -1);
 
 			g_free(enc_out);
--- a/libpurple/protocols/jabber/auth_plain.c	Fri Nov 27 20:36:31 2009 +0000
+++ b/libpurple/protocols/jabber/auth_plain.c	Fri Nov 27 20:41:22 2009 +0000
@@ -38,7 +38,7 @@
 	gchar *enc_out;
 
 	auth = xmlnode_new("auth");
-	xmlnode_set_namespace(auth, "urn:ietf:params:xml:ns:xmpp-sasl");
+	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");
--- a/libpurple/protocols/jabber/auth_scram.c	Fri Nov 27 20:36:31 2009 +0000
+++ b/libpurple/protocols/jabber/auth_scram.c	Fri Nov 27 20:41:22 2009 +0000
@@ -387,7 +387,7 @@
 	data->step = 1;
 
 	reply = xmlnode_new("auth");
-	xmlnode_set_namespace(reply, "urn:ietf:params:xml:ns:xmpp-sasl");
+	xmlnode_set_namespace(reply, NS_XMPP_SASL);
 	xmlnode_set_attrib(reply, "mechanism", js->auth_mech->name);
 
 	/* TODO: Channel binding */
@@ -414,7 +414,7 @@
 	enc_in = xmlnode_get_data(challenge);
 	if (!enc_in || *enc_in == '\0') {
 		reply = xmlnode_new("abort");
-		xmlnode_set_namespace(reply, "urn:ietf:params:xml:ns:xmpp-sasl");
+		xmlnode_set_namespace(reply, NS_XMPP_SASL);
 		data->step = -1;
 		goto out;
 	}
@@ -424,7 +424,7 @@
 	if (!dec_in || len != strlen(dec_in)) {
 		/* Danger afoot; SCRAM shouldn't contain NUL bytes */
 		reply = xmlnode_new("abort");
-		xmlnode_set_namespace(reply, "urn:ietf:params:xml:ns:xmpp-sasl");
+		xmlnode_set_namespace(reply, NS_XMPP_SASL);
 		data->step = -1;
 		goto out;
 	}
@@ -433,7 +433,7 @@
 
 	if (!jabber_scram_feed_parser(data, dec_in, &dec_out)) {
 		reply = xmlnode_new("abort");
-		xmlnode_set_namespace(reply, "urn:ietf:params:xml:ns:xmpp-sasl");
+		xmlnode_set_namespace(reply, NS_XMPP_SASL);
 		data->step = -1;
 		goto out;
 	}
@@ -441,7 +441,7 @@
 	data->step += 1;
 
 	reply = xmlnode_new("response");
-	xmlnode_set_namespace(reply, "urn:ietf:params:xml:ns:xmpp-sasl");
+	xmlnode_set_namespace(reply, NS_XMPP_SASL);
 
 	purple_debug_misc("jabber", "decoded response: %s\n", dec_out ? dec_out : "(null)");
 	if (dec_out) {