changeset 23658:860e5e210fc9

Don't print SOAP messages to debug log for "secure" requests. This is really just for the login requests so that people don't accidentally post their username and passwords. Fixes #6445.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 29 Jul 2008 07:01:30 +0000
parents 7f4b697c6947
children c1e23b9d9cf5
files libpurple/protocols/msn/contact.c libpurple/protocols/msn/nexus.c libpurple/protocols/msn/oim.c libpurple/protocols/msn/soap.c libpurple/protocols/msn/soap.h
diffstat 5 files changed, 34 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Tue Jul 29 06:12:40 2008 +0000
+++ b/libpurple/protocols/msn/contact.c	Tue Jul 29 07:01:30 2008 +0000
@@ -228,8 +228,8 @@
 	msn_soap_message_send(session,
 		msn_soap_message_new(MSN_ADD_ADDRESSBOOK_SOAP_ACTION,
 			xmlnode_from_str(body, -1)),
-		MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, msn_create_address_cb,
-		session);
+		MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, FALSE,
+		msn_create_address_cb, session);
 
 	g_free(body);
 }
@@ -415,7 +415,7 @@
 	msn_soap_message_send(session,
 		msn_soap_message_new(MSN_GET_CONTACT_SOAP_ACTION,
 			xmlnode_from_str(body, -1)),
-		MSN_CONTACT_SERVER, MSN_GET_CONTACT_POST_URL,
+		MSN_CONTACT_SERVER, MSN_GET_CONTACT_POST_URL, FALSE,
 		msn_get_contact_list_cb, g_memdup(&cb_data, sizeof(cb_data)));
 
 	g_free(update_str);
@@ -815,8 +815,8 @@
 	msn_soap_message_send(session,
 		msn_soap_message_new(MSN_GET_ADDRESS_SOAP_ACTION,
 			xmlnode_from_str(body, -1)),
-		MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, msn_get_address_cb,
-		session);
+		MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, FALSE,
+		msn_get_address_cb, session);
 
 	g_free(update_str);
 	g_free(body);
@@ -917,7 +917,8 @@
 		msn_nexus_get_token_str(state->session->nexus, MSN_AUTH_CONTACTS), -1);
 	msn_soap_message_send(state->session,
 		msn_soap_message_new(state->post_action, xmlnode_copy(state->body)),
-		MSN_CONTACT_SERVER, state->post_url, msn_contact_request_cb, state);
+		MSN_CONTACT_SERVER, state->post_url, FALSE,
+		msn_contact_request_cb, state);
 	return FALSE;
 }
 
--- a/libpurple/protocols/msn/nexus.c	Tue Jul 29 06:12:40 2008 +0000
+++ b/libpurple/protocols/msn/nexus.c	Tue Jul 29 07:01:30 2008 +0000
@@ -411,7 +411,7 @@
 
 	soap = msn_soap_message_new(NULL, xmlnode_from_str(request, -1));
 	g_free(request);
-	msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL,
+	msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL, TRUE,
 	                      nexus_got_response_cb, nexus);
 }
 
@@ -597,7 +597,7 @@
 
 	soap = msn_soap_message_new(NULL, xmlnode_from_str(request, -1));
 	g_free(request);
-	msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL,
+	msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL, TRUE,
 	                      nexus_got_update_cb, ud);
 }
 
--- a/libpurple/protocols/msn/oim.c	Tue Jul 29 06:12:40 2008 +0000
+++ b/libpurple/protocols/msn/oim.c	Tue Jul 29 07:01:30 2008 +0000
@@ -219,7 +219,8 @@
 
 	msn_soap_message_send(session,
 		msn_soap_message_new(data->action, xmlnode_copy(data->body)),
-		data->host, data->url, msn_oim_request_cb, data);
+		data->host, data->url, FALSE,
+		msn_oim_request_cb, data);
 }
 
 
--- a/libpurple/protocols/msn/soap.c	Tue Jul 29 06:12:40 2008 +0000
+++ b/libpurple/protocols/msn/soap.c	Tue Jul 29 07:01:30 2008 +0000
@@ -42,6 +42,7 @@
 typedef struct _MsnSoapRequest {
 	char *path;
 	MsnSoapMessage *message;
+	gboolean secure;
 	MsnSoapCallback cb;
 	gpointer cb_data;
 } MsnSoapRequest;
@@ -76,8 +77,8 @@
 static void msn_soap_connection_handle_next(MsnSoapConnection *conn);
 static void msn_soap_connection_destroy(MsnSoapConnection *conn);
 
-static void msn_soap_message_send_internal(MsnSession *session,
-	MsnSoapMessage *message, const char *host, const char *path,
+static void msn_soap_message_send_internal(MsnSession *session, MsnSoapMessage *message,
+	const char *host, const char *path, gboolean secure,
 	MsnSoapCallback cb, gpointer cb_data, gboolean first);
 
 static void msn_soap_request_destroy(MsnSoapRequest *req, gboolean keep_message);
@@ -187,8 +188,8 @@
 	char *path;
 
 	if (purple_url_parse(url, &host, NULL, &path, NULL, NULL)) {
-		msn_soap_message_send_internal(conn->session,
-			conn->current_request->message,	host, path,
+		msn_soap_message_send_internal(conn->session, conn->current_request->message,
+			host, path, conn->current_request->secure,
 			conn->current_request->cb, conn->current_request->cb_data, TRUE);
 
 		msn_soap_request_destroy(conn->current_request, TRUE);
@@ -309,6 +310,11 @@
 	char *cursor;
 	char *linebreak;
 
+#ifndef MSN_UNSAFE_DEBUG
+	if (conn->current_request->secure)
+		purple_debug_info("soap", "Received secure request.\n");
+	else
+#endif
 	purple_debug_info("soap", "current %s\n", conn->buf->str);
 
 	cursor = conn->buf->str + conn->handled_len;
@@ -506,6 +512,11 @@
 			g_string_append(conn->buf, "\r\n");
 			g_string_append(conn->buf, body);
 
+#ifndef MSN_UNSAFE_DEBUG
+			if (req->secure)
+				purple_debug_info("soap", "Sending secure request.\n");
+			else
+#endif
 			purple_debug_info("soap", "%s\n", conn->buf->str);
 
 			conn->handled_len = 0;
@@ -534,16 +545,16 @@
 
 void
 msn_soap_message_send(MsnSession *session, MsnSoapMessage *message,
-	const char *host, const char *path,
+	const char *host, const char *path, gboolean secure,
 	MsnSoapCallback cb, gpointer cb_data)
 {
-	msn_soap_message_send_internal(session, message, host, path, cb, cb_data,
-		FALSE);
+	msn_soap_message_send_internal(session, message, host, path, secure,
+		cb, cb_data, FALSE);
 }
 
 static void
-msn_soap_message_send_internal(MsnSession *session,
-	MsnSoapMessage *message, const char *host, const char *path,
+msn_soap_message_send_internal(MsnSession *session, MsnSoapMessage *message,
+	const char *host, const char *path, gboolean secure,
 	MsnSoapCallback cb, gpointer cb_data, gboolean first)
 {
 	MsnSoapConnection *conn = msn_soap_get_connection(session, host);
@@ -551,6 +562,7 @@
 
 	req->path = g_strdup(path);
 	req->message = message;
+	req->secure = secure;
 	req->cb = cb;
 	req->cb_data = cb_data;
 
--- a/libpurple/protocols/msn/soap.h	Tue Jul 29 06:12:40 2008 +0000
+++ b/libpurple/protocols/msn/soap.h	Tue Jul 29 07:01:30 2008 +0000
@@ -47,8 +47,8 @@
 void msn_soap_message_add_header(MsnSoapMessage *req,
 	const char *name, const char *value);
 
-void msn_soap_message_send(MsnSession *session,
-	MsnSoapMessage *message, const char *host, const char *path,
+void msn_soap_message_send(MsnSession *session, MsnSoapMessage *message,
+	const char *host, const char *path, gboolean secure,
 	MsnSoapCallback cb, gpointer cb_data);
 
 void msn_soap_message_destroy(MsnSoapMessage *message);