/pidgin/main: 5ab172aeeff2: Merge with release-2.x.y

Daniel Atallah datallah at pidgin.im
Sun Mar 3 18:35:54 EST 2013


Changeset: 5ab172aeeff2627307302e742d631805731bb567
Author:	 Daniel Atallah <datallah at pidgin.im>
Date:	 2013-03-03 18:35 -0500
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/5ab172aeeff2

Description:

Merge with release-2.x.y

diffstat:

 finch/gntpounce.c                       |   6 +---
 finch/libgnt/gntwm.c                    |   6 ++++-
 libpurple/example/nullclient.c          |  10 +++++--
 libpurple/plugins/ssl/ssl-nss.c         |   2 +-
 libpurple/protocols/irc/msgs.c          |   2 +-
 libpurple/protocols/irc/parse.c         |  12 +++++----
 libpurple/protocols/jabber/auth_cyrus.c |  40 +++++++++++++++++++-------------
 libpurple/protocols/jabber/ibb.c        |   4 ---
 libpurple/protocols/jabber/oob.c        |   9 +++++-
 libpurple/protocols/jabber/usermood.c   |   4 +--
 libpurple/protocols/msn/soap.c          |   3 +-
 libpurple/protocols/mxit/protocol.c     |   8 +++++-
 libpurple/protocols/novell/novell.c     |   1 -
 libpurple/protocols/oscar/oscar.c       |  12 ---------
 libpurple/protocols/oscar/userinfo.c    |   1 -
 libpurple/protocols/silc/chat.c         |   4 +-
 libpurple/protocols/silc/silc.c         |   7 ++---
 libpurple/protocols/silc/silcpurple.h   |   2 +-
 libpurple/protocols/silc/util.c         |   2 +-
 libpurple/protocols/yahoo/libymsg.c     |   3 --
 libpurple/util.c                        |   5 ++-
 pidgin/gtkimhtml.c                      |   2 +-
 po/de.po                                |  10 ++++++-
 23 files changed, 83 insertions(+), 72 deletions(-)

diffs (truncated from 473 to 300 lines):

diff --git a/finch/gntpounce.c b/finch/gntpounce.c
--- a/finch/gntpounce.c
+++ b/finch/gntpounce.c
@@ -801,10 +801,8 @@ pounce_cb(PurplePounce *pounce, PurplePo
 
 	if (purple_pounce_action_is_enabled(pounce, "open-window"))
 	{
-		conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, pouncee, account);
-
-		if (conv == NULL)
-			conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, pouncee);
+		if (!purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, pouncee, account))
+			purple_conversation_new(PURPLE_CONV_TYPE_IM, account, pouncee);
 	}
 
 	if (purple_pounce_action_is_enabled(pounce, "popup-notify"))
diff --git a/finch/libgnt/gntwm.c b/finch/libgnt/gntwm.c
--- a/finch/libgnt/gntwm.c
+++ b/finch/libgnt/gntwm.c
@@ -1243,7 +1243,11 @@ ignore_keys_start(GntBindable *bindable,
 static gboolean
 ignore_keys_end(GntBindable *bindable, GList *n)
 {
-	return ignore_keys ? !(ignore_keys = FALSE) : FALSE;
+	if (ignore_keys) {
+		ignore_keys = FALSE;
+		return TRUE;
+	}
+	return FALSE;
 }
 
 static gboolean
diff --git a/libpurple/example/nullclient.c b/libpurple/example/nullclient.c
--- a/libpurple/example/nullclient.c
+++ b/libpurple/example/nullclient.c
@@ -242,7 +242,7 @@ int main(int argc, char *argv[])
 	GList *iter;
 	int i, num;
 	GList *names = NULL;
-	const char *prpl;
+	const char *prpl = NULL;
 	char name[128];
 	char *password;
 	GMainLoop *loop = g_main_loop_new(NULL, FALSE);
@@ -278,8 +278,12 @@ int main(int argc, char *argv[])
 		fprintf(stderr, "Failed to gets protocol selection.");
 		abort();
 	}
-	sscanf(name, "%d", &num);
-	prpl = g_list_nth_data(names, num);
+	if (sscanf(name, "%d", &num) == 1)
+		prpl = g_list_nth_data(names, num);
+	if (!prpl) {
+		fprintf(stderr, "Failed to gets protocol.");
+		abort();
+	}
 
 	printf("Username: ");
 	res = fgets(name, sizeof(name), stdin);
diff --git a/libpurple/plugins/ssl/ssl-nss.c b/libpurple/plugins/ssl/ssl-nss.c
--- a/libpurple/plugins/ssl/ssl-nss.c
+++ b/libpurple/plugins/ssl/ssl-nss.c
@@ -756,7 +756,7 @@ x509_signed_by(PurpleCertificate * crt,
 	subjectCert = X509_NSS_DATA(crt);
 	g_return_val_if_fail(subjectCert, FALSE);
 
-	if (subjectCert->issuerName == NULL
+	if (subjectCert->issuerName == NULL || issuerCert->subjectName == NULL
 			|| PORT_Strcmp(subjectCert->issuerName, issuerCert->subjectName) != 0)
 		return FALSE;
 	st = CERT_VerifySignedData(&subjectCert->signatureWrap, issuerCert, PR_Now(), NULL);
diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c
--- a/libpurple/protocols/irc/msgs.c
+++ b/libpurple/protocols/irc/msgs.c
@@ -99,7 +99,7 @@ static void irc_connected(struct irc_con
 
 	/* If we're away then set our away message */
 	status = purple_account_get_active_status(irc->account);
-	if (!purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) {
+	if (purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) {
 		PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
 		prpl_info->set_status(irc->account, status);
 	}
diff --git a/libpurple/protocols/irc/parse.c b/libpurple/protocols/irc/parse.c
--- a/libpurple/protocols/irc/parse.c
+++ b/libpurple/protocols/irc/parse.c
@@ -559,14 +559,16 @@ char *irc_parse_ctcp(struct irc_conn *ir
 		return buf;
 	} else if (!strncmp(cur, "PING ", 5)) {
 		if (notice) { /* reply */
-			/* TODO: Should this read in the timestamp as a double? */
-			sscanf(cur, "PING %lu", &timestamp);
 			gc = purple_account_get_connection(irc->account);
 			if (!gc)
 				return NULL;
-			buf = g_strdup_printf(_("Reply time from %s: %lu seconds"), from, time(NULL) - timestamp);
-			purple_notify_info(gc, _("PONG"), _("CTCP PING reply"), buf);
-			g_free(buf);
+			/* TODO: Should this read in the timestamp as a double? */
+			if (sscanf(cur, "PING %lu", &timestamp) == 1) {
+				buf = g_strdup_printf(_("Reply time from %s: %lu seconds"), from, time(NULL) - timestamp);
+				purple_notify_info(gc, _("PONG"), _("CTCP PING reply"), buf);
+				g_free(buf);
+			} else
+				purple_debug(PURPLE_DEBUG_ERROR, "irc", "Unable to parse PING timestamp");
 			return NULL;
 		} else {
 			buf = irc_format(irc, "vt:", "NOTICE", from, msg);
diff --git a/libpurple/protocols/jabber/auth_cyrus.c b/libpurple/protocols/jabber/auth_cyrus.c
--- a/libpurple/protocols/jabber/auth_cyrus.c
+++ b/libpurple/protocols/jabber/auth_cyrus.c
@@ -178,6 +178,25 @@ auth_no_pass_cb(PurpleConnection *gc, Pu
 	purple_account_set_enabled(account, purple_core_get_ui(), FALSE);
 }
 
+static gboolean remove_current_mech(JabberStream *js) {
+	char *pos;
+	if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) {
+		int len = strlen(js->current_mech);
+		/* Clean up space that separated this Mech from the one before or after it */
+		if (pos > js->sasl_mechs->str && *(pos - 1) == ' ') {
+			/* Handle removing space before when current_mech isn't the first mech in the list */
+			pos--;
+			len++;
+		} else if (strlen(pos) > len && *(pos + len) == ' ') {
+			/* Handle removing space after */
+			len++;
+		}
+		g_string_erase(js->sasl_mechs, pos - js->sasl_mechs->str, len);
+		return TRUE;
+	}
+	return FALSE;
+}
+
 static JabberSaslState
 jabber_auth_start_cyrus(JabberStream *js, xmlnode **reply, char **error)
 {
@@ -299,14 +318,8 @@ jabber_auth_start_cyrus(JabberStream *js
 				 * supported mechanisms. This code handles that case
 				 */
 				if (js->current_mech && *js->current_mech) {
-					char *pos;
-					if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) {
-						g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech));
-					}
-					/* Remove space which separated this mech from the next */
-					if ((js->sasl_mechs->str)[0] == ' ') {
-						g_string_erase(js->sasl_mechs, 0, 1);
-					}
+					remove_current_mech(js);
+					/* Should we only try again if we've removed the mech? */
 					again = TRUE;
 				}
 
@@ -545,15 +558,10 @@ jabber_cyrus_handle_failure(JabberStream
 {
 	if (js->auth_fail_count++ < 5) {
 		if (js->current_mech && *js->current_mech) {
-			char *pos;
-			if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) {
-				g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech));
-			}
-			/* Remove space which separated this mech from the next */
-			if ((js->sasl_mechs->str)[0] == ' ') {
-				g_string_erase(js->sasl_mechs, 0, 1);
-			}
+			remove_current_mech(js);
 		}
+
+		/* Should we only try again if we've actually removed a mech? */
 		if (*js->sasl_mechs->str) {
 			/* If we have remaining mechs to try, do so */
 			sasl_dispose(&js->sasl);
diff --git a/libpurple/protocols/jabber/ibb.c b/libpurple/protocols/jabber/ibb.c
--- a/libpurple/protocols/jabber/ibb.c
+++ b/libpurple/protocols/jabber/ibb.c
@@ -472,10 +472,6 @@ jabber_ibb_parse(JabberStream *js, const
 				purple_debug_info("jabber", "IBB: calling closed handler\n");
 				sess->closed_cb(sess);
 			}
-
-		} else {
-			/* this should never happen */
-			purple_debug_error("jabber", "Received bogus iq for IBB session\n");
 		}
 	} else if (open) {
 		JabberIq *result;
diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c
--- a/libpurple/protocols/jabber/oob.c
+++ b/libpurple/protocols/jabber/oob.c
@@ -138,8 +138,13 @@ static gssize jabber_oob_xfer_read(gucha
 			lenstr = strstr(jox->headers->str, "Content-Length: ");
 			if(lenstr) {
 				goffset size;
-				sscanf(lenstr, "Content-Length: %" G_GOFFSET_FORMAT, &size);
-				purple_xfer_set_size(xfer, size);
+				if (sscanf(lenstr, "Content-Length: %" G_GOFFSET_FORMAT, &size) == 1)
+					purple_xfer_set_size(xfer, size);
+				else {
+					purple_debug_error("jabber", "Unable to parse Content-Length!\n");
+					purple_xfer_cancel_local(xfer);
+					return 0;
+				}
 			}
 			purple_xfer_set_read_fnc(xfer, NULL);
 
diff --git a/libpurple/protocols/jabber/usermood.c b/libpurple/protocols/jabber/usermood.c
--- a/libpurple/protocols/jabber/usermood.c
+++ b/libpurple/protocols/jabber/usermood.c
@@ -162,11 +162,9 @@ static void jabber_mood_cb(JabberStream 
 				newmood = target_mood ? target_mood->mood : NULL;
 			}
 
-			if (newmood != NULL && moodtext != NULL)
-			   break;
 		}
 		if (newmood != NULL && moodtext != NULL)
-		   break;
+			break;
 	}
 	if (newmood != NULL) {
 		purple_prpl_got_user_status(purple_connection_get_account(js->gc), from, "mood",
diff --git a/libpurple/protocols/msn/soap.c b/libpurple/protocols/msn/soap.c
--- a/libpurple/protocols/msn/soap.c
+++ b/libpurple/protocols/msn/soap.c
@@ -426,7 +426,8 @@ msn_soap_process(MsnSoapConnection *conn
 					g_free(line);
 					return;
 				} else if (strcmp(key, "Content-Length") == 0) {
-					sscanf(value, "%" G_GSIZE_FORMAT, &(conn->body_len));
+					if (sscanf(value, "%" G_GSIZE_FORMAT, &(conn->body_len)) != 1)
+						purple_debug_error("soap", "Unable to parse Content-Length\n");
 				} else if (strcmp(key, "Connection") == 0) {
 					if (strcmp(value, "close") == 0) {
 						conn->close_when_done = TRUE;
diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c
--- a/libpurple/protocols/mxit/protocol.c
+++ b/libpurple/protocols/mxit/protocol.c
@@ -868,9 +868,15 @@ void mxit_send_extprofile_update( struct
 	);
 
 	/* add attributes */
-	for ( i = 1; i < nr_attrib * 3; i+=3 )
+	for ( i = 1; i < nr_attrib * 3; i+=3 ) {
+		if ( parts == NULL || parts[i] == NULL || parts[i + 1] == NULL || parts[i + 2] == NULL ) {
+			purple_debug_error( MXIT_PLUGIN_ID, "Invalid profile update attributes = '%s' - nbr=%u\n", attributes, nr_attrib );
+			g_strfreev( parts );
+			return;
+		}
 		datalen += sprintf( data + datalen, "%c%s%c%s%c%s",		/* \1name\1type\1value  */
 								CP_FLD_TERM, parts[i], CP_FLD_TERM, parts[i + 1], CP_FLD_TERM, parts[i + 2] );
+	}
 
 	/* queue packet for transmission */
 	mxit_queue_packet( session, data, datalen, CP_CMD_EXTPROFILE_SET );
diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c
--- a/libpurple/protocols/novell/novell.c
+++ b/libpurple/protocols/novell/novell.c
@@ -3314,7 +3314,6 @@ novell_set_permit_deny(PurpleConnection 
 				for (node = purple_connection_get_account(gc)->permit; node; node = node->next) {
 					dn = nm_lookup_dn(user, (char *)node->data);
 					if (dn) {
-						user_record = nm_find_user_record(user, dn);
 
 						if (!g_slist_find_custom(user->allow_list,
 												 dn, (GCompareFunc)purple_utf8_strcasecmp)) {
diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c
--- a/libpurple/protocols/oscar/oscar.c
+++ b/libpurple/protocols/oscar/oscar.c
@@ -2686,7 +2686,6 @@ purple_icons_fetch(PurpleConnection *gc)
 }
 
 static int purple_selfinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
-	int warning_level;
 	va_list ap;
 	aim_userinfo_t *info;
 
@@ -2696,15 +2695,6 @@ static int purple_selfinfo(OscarData *od
 
 	purple_connection_set_display_name(od->gc, info->bn);
 
-	/*
-	 * What's with the + 0.5?
-	 * The 0.5 is basically poor-man's rounding.  Normally
-	 * casting "13.7" to an int will truncate to "13," but
-	 * with 13.7 + 0.5 = 14.2, which becomes "14" when
-	 * truncated.
-	 */
-	warning_level = info->warnlevel/10.0 + 0.5;
-
 	return 1;
 }
 
@@ -4566,7 +4556,6 @@ const char *oscar_list_emblem(PurpleBudd
 	OscarData *od = NULL;
 	PurpleAccount *account = NULL;
 	PurplePresence *presence;
-	PurpleStatus *status;
 	aim_userinfo_t *userinfo = NULL;
 	const char *name;



More information about the Commits mailing list