cpw.darkrain42.xmpp.scram: 3e559319: jabber: Use NS_XMPP_SASL

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Nov 29 12:43:01 EST 2009


-----------------------------------------------------------------
Revision: 3e55931996c480c5fbf5df7ebd49bfd35ee5f8ee
Ancestor: 048091309829444ce15414ef3263e1fba7c6d096
Author: darkrain42 at pidgin.im
Date: 2009-11-27T20:41:22
Branch: im.pidgin.cpw.darkrain42.xmpp.scram
URL: http://d.pidgin.im/viewmtn/revision/info/3e55931996c480c5fbf5df7ebd49bfd35ee5f8ee

Modified 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

ChangeLog: 

jabber: Use NS_XMPP_SASL

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/auth.c	186e224cd251d59ac1c1d6d98c45595b1b17ca0e
+++ libpurple/protocols/jabber/auth.c	33525782a88e6371457b1b7bb399cf0bfcdee44a
@@ -111,6 +111,7 @@ static void disallow_plaintext_auth(Purp
 		_("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 @@ auth_no_pass_cb(PurpleConnection *gc, Pu
 	/* 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 @@ jabber_auth_handle_challenge(JabberStrea
 {
 	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 @@ void jabber_auth_handle_success(JabberSt
 {
 	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"));
============================================================
--- libpurple/protocols/jabber/auth_cyrus.c	ad644cc8cf459c48b1ae43dd1b19b62cadce054f
+++ libpurple/protocols/jabber/auth_cyrus.c	d240f2cadfc446736a57e55eeeba97e8051d036e
@@ -302,7 +302,7 @@ static xmlnode *jabber_auth_start_cyrus(
 
 	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 @@ static xmlnode *jabber_cyrus_handle_chal
 		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
============================================================
--- libpurple/protocols/jabber/auth_digest_md5.c	814134a6845f0328921cce6d3bd5fac955978634
+++ libpurple/protocols/jabber/auth_digest_md5.c	d9ecb35ff0a36daefb463c56905396dfadc8938f
@@ -35,7 +35,7 @@ static xmlnode *digest_md5_start(JabberS
 	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 @@ static xmlnode *digest_md5_handle_challe
 
 		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 @@ static xmlnode *digest_md5_handle_challe
 					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);
============================================================
--- libpurple/protocols/jabber/auth_plain.c	d12183f7cb820d0d90a9453f7a6b8abcc6f0a28f
+++ libpurple/protocols/jabber/auth_plain.c	c86a14b6b296440a33e7495d4435eaf0df0ec61f
@@ -38,7 +38,7 @@ static xmlnode *finish_plaintext_authent
 	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");
============================================================
--- libpurple/protocols/jabber/auth_scram.c	1980c9ed827e25c56fcff1641a375393ae10175d
+++ libpurple/protocols/jabber/auth_scram.c	58cb4d7993882757edb91d259b05f2fb44bcff51
@@ -387,7 +387,7 @@ static xmlnode *scram_start(JabberStream
 	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 @@ static xmlnode *scram_handle_challenge(J
 	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 @@ static xmlnode *scram_handle_challenge(J
 	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 @@ static xmlnode *scram_handle_challenge(J
 
 	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 @@ static xmlnode *scram_handle_challenge(J
 	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) {


More information about the Commits mailing list