/pidgin/main: 06b74c255e95: Merge release-2.x.y

Tomasz Wasilczyk twasilczyk at pidgin.im
Sat May 9 08:56:25 EDT 2015


Changeset: 06b74c255e953e0d7b4549eaef4c849ea36ac2fb
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2015-05-09 14:56 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/06b74c255e95

Description:

Merge release-2.x.y

diffstat:

 ChangeLog                                 |     3 +
 libpurple/protocols/gg/lib/config.h       |     2 +-
 libpurple/protocols/gg/lib/dcc.c          |    11 +-
 libpurple/protocols/gg/lib/handlers.c     |    76 +-
 libpurple/protocols/gg/lib/libgadu.c      |     3 +-
 libpurple/protocols/gg/lib/packets.pb-c.c |   839 ++-
 libpurple/protocols/gg/lib/packets.pb-c.h |   106 +-
 libpurple/protocols/gg/lib/protobuf-c.c   |  5378 ++++++++++++++++------------
 libpurple/protocols/gg/lib/protobuf-c.h   |  1492 +++++--
 libpurple/protocols/gg/lib/protobuf.h     |     2 +-
 libpurple/protocols/gg/lib/protocol.h     |     6 +-
 libpurple/protocols/gg/lib/pubdir50.c     |     2 +-
 libpurple/protocols/gg/lib/sha1.c         |    12 +-
 13 files changed, 4713 insertions(+), 3219 deletions(-)

diffs (truncated from 10145 to 300 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -102,6 +102,9 @@ version 2.10.12 (MM/DD/YY):
 		* SILC 1.1.12
 	* Remove support for Tcl plugins
 
+	Gadu-Gadu:
+	* Updated internal libgadu to version 1.12.1.
+
 version 2.10.11 (11/23/14):
 	General:
 	* Fix handling of Self-Signed SSL/TLS Certificates when using the NSS
diff --git a/libpurple/protocols/gg/lib/config.h b/libpurple/protocols/gg/lib/config.h
--- a/libpurple/protocols/gg/lib/config.h
+++ b/libpurple/protocols/gg/lib/config.h
@@ -5,7 +5,7 @@
 /* libpurple's config */
 #include <config.h>
 
-#define GG_LIBGADU_VERSION "1.12.0"
+#define GG_LIBGADU_VERSION "1.12.1"
 
 /* Defined if libgadu was compiled for bigendian machine. */
 #undef GG_CONFIG_BIGENDIAN
diff --git a/libpurple/protocols/gg/lib/dcc.c b/libpurple/protocols/gg/lib/dcc.c
--- a/libpurple/protocols/gg/lib/dcc.c
+++ b/libpurple/protocols/gg/lib/dcc.c
@@ -650,6 +650,7 @@ struct gg_event *gg_dcc_watch_fd(struct 
 		unsigned int utmp;
 		socklen_t res_size = sizeof(res);
 		char buf[1024], ack[] = "UDAG";
+		void *tmp_buf;
 
 		struct gg_dcc_file_info_packet {
 			struct gg_dcc_big_packet big;
@@ -799,11 +800,14 @@ struct gg_event *gg_dcc_watch_fd(struct 
 				h->state = GG_STATE_READING_FILE_HEADER;
 				h->chunk_size = sizeof(big_pkt);
 				h->chunk_offset = 0;
-				if (!(h->chunk_buf = malloc(sizeof(big_pkt)))) {
+				h->chunk_buf = NULL;
+				tmp_buf = malloc(sizeof(big_pkt));
+				if (!tmp_buf) {
 					gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() out of memory\n");
 					free(e);
 					return NULL;
 				}
+				h->chunk_buf = tmp_buf;
 				h->check = GG_CHECK_READ;
 				h->timeout = GG_DEFAULT_TIMEOUT;
 
@@ -1342,11 +1346,14 @@ struct gg_event *gg_dcc_watch_fd(struct 
 					h->timeout = GG_DEFAULT_TIMEOUT;
 					h->chunk_offset = 0;
 					h->chunk_size = sizeof(big_pkt);
-					if (!(h->chunk_buf = malloc(sizeof(big_pkt)))) {
+					h->chunk_buf = NULL;
+					tmp_buf = malloc(sizeof(big_pkt));
+					if (!tmp_buf) {
 						gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() out of memory\n");
 						free(e);
 						return NULL;
 					}
+					h->chunk_buf = tmp_buf;
 				} else {
 					h->state = GG_STATE_GETTING_FILE;
 					h->timeout = GG_DCC_TIMEOUT_GET;
diff --git a/libpurple/protocols/gg/lib/handlers.c b/libpurple/protocols/gg/lib/handlers.c
--- a/libpurple/protocols/gg/lib/handlers.c
+++ b/libpurple/protocols/gg/lib/handlers.c
@@ -48,6 +48,10 @@
 #include <string.h>
 #include <time.h>
 
+/* Ograniczenie długości listy kontaktów
+ * z pakietów GG_USERLIST_REPLY do 10MB. */
+#define GG_USERLIST_REPLY_MAX_LENGTH 10485760
+
 /**
  * \internal Struktura opisujÄ
ca funkcję obsługi pakietu.
  */
@@ -631,6 +635,13 @@ static int gg_session_handle_userlist_re
 		gg_debug_session(gs, GG_DEBUG_MISC, "userlist_reply=%p, len=%"
 			GG_SIZE_FMT "\n", gs->userlist_reply, len);
 
+		if (reply_len + len > GG_USERLIST_REPLY_MAX_LENGTH) {
+			gg_debug_session(gs, GG_DEBUG_MISC,
+				"// gg_session_handle_userlist_reply() "
+				"too many userlist replies\n");
+			return -1;
+		}
+
 		tmp = realloc(gs->userlist_reply, reply_len + len);
 
 		if (tmp == NULL) {
@@ -1737,7 +1748,7 @@ static int gg_session_handle_notify_repl
 	while (length >= sizeof(struct gg_notify_reply80)) {
 		uin_t uin = gg_fix32(n->uin);
 		int descr_len;
-		char *tmp;
+		void *tmp;
 
 		ge->event.notify60[i].uin = uin;
 		ge->event.notify60[i].status = gg_fix32(n->status);
@@ -1782,7 +1793,7 @@ static int gg_session_handle_notify_repl
 			return -1;
 		}
 
-		ge->event.notify60 = (void*) tmp;
+		ge->event.notify60 = tmp;
 		ge->event.notify60[++i].uin = 0;
 	}
 
@@ -1814,7 +1825,7 @@ static int gg_session_handle_notify_repl
 
 	while (length >= sizeof(struct gg_notify_reply77)) {
 		uin_t uin = gg_fix32(n->uin);
-		char *tmp;
+		void *tmp;
 
 		ge->event.notify60[i].uin = uin & 0x00ffffff;
 		ge->event.notify60[i].status = n->status;
@@ -1867,7 +1878,7 @@ static int gg_session_handle_notify_repl
 			return -1;
 		}
 
-		ge->event.notify60 = (void*) tmp;
+		ge->event.notify60 = tmp;
 		ge->event.notify60[++i].uin = 0;
 	}
 
@@ -1899,7 +1910,7 @@ static int gg_session_handle_notify_repl
 
 	while (length >= sizeof(struct gg_notify_reply60)) {
 		uin_t uin = gg_fix32(n->uin);
-		char *tmp;
+		void *tmp;
 
 		ge->event.notify60[i].uin = uin & 0x00ffffff;
 		ge->event.notify60[i].status = n->status;
@@ -1954,7 +1965,7 @@ static int gg_session_handle_notify_repl
 			return -1;
 		}
 
-		ge->event.notify60 = (void*) tmp;
+		ge->event.notify60 = tmp;
 		ge->event.notify60[++i].uin = 0;
 	}
 
@@ -2360,18 +2371,20 @@ static int gg_session_handle_imtoken(str
 static int gg_session_handle_pong_110(struct gg_session *gs, uint32_t type,
 	const char *ptr, size_t len, struct gg_event *ge)
 {
-	const struct gg_pong110 *pong = (const struct gg_pong110*)ptr;
-	uint32_t server_time;
+	GG110Pong *msg = gg110_pong__unpack(NULL, len, (uint8_t*)ptr);
+
+	if (!GG_PROTOBUF_VALID(gs, "GG110Pong", msg))
+		return -1;
 
 	gg_debug_session(gs, GG_DEBUG_MISC, "// gg_watch_fd_connected() "
 		"received pong110\n");
 
-	server_time = gg_fix32(pong->time);
-
 	ge->type = GG_EVENT_PONG110;
-	ge->event.pong110.time = server_time;
-
-	gg_sync_time(gs, server_time);
+	ge->event.pong110.time = msg->server_time;
+
+	gg_sync_time(gs, msg->server_time);
+
+	gg110_pong__free_unpacked(msg, NULL);
 
 	return 0;
 }
@@ -2653,7 +2666,12 @@ static int gg_session_handle_transfer_in
 	if (!GG_PROTOBUF_VALID(gs, "GG112TransferInfo", msg))
 		return -1;
 
-	gg_protobuf_expected(gs, "GG112TransferInfo.dummy1", msg->dummy1, 6);
+	/* see packets.proto */
+	if (msg->dummy1 != 5 && msg->dummy1 != 6) {
+		gg_debug_session(gs, GG_DEBUG_MISC | GG_DEBUG_WARNING,
+			"// gg_session_handle_transfer_info: "
+			"unknown dummy1 value: %d\n", msg->dummy1);
+	}
 
 	if (GG_PROTOBUF_VALID(gs, "GG112TransferInfoUin", msg->peer)) {
 		gg_protobuf_expected(gs, "GG112TransferInfoUin.dummy1",
@@ -2682,7 +2700,7 @@ static int gg_session_handle_transfer_in
 			kvp->key, kvp->value);
 	}
 
-	if (GG_PROTOBUF_VALID(gs, "GG112TransferInfoFile", msg->file)) {
+	if (msg->file && GG_PROTOBUF_VALID(gs, "GG112TransferInfoFile", msg->file)) {
 		GG112TransferInfoFile *file = msg->file;
 		gg_debug_session(gs, GG_DEBUG_MISC,
 			"// gg_session_handle_transfer_info file: "
@@ -2700,6 +2718,29 @@ static int gg_session_handle_transfer_in
 	return succ ? 0 : -1;
 }
 
+static int gg_session_handle_magic_notification(struct gg_session *gs, uint32_t type,
+	const char *ptr, size_t len, struct gg_event *ge)
+{
+	GG110MagicNotification *msg = gg110_magic_notification__unpack(NULL, len, (uint8_t*)ptr);
+	int succ = 1;
+
+	if (!GG_PROTOBUF_VALID(gs, "GG110MagicNotification", msg))
+		return -1;
+
+	gg_debug_session(gs, GG_DEBUG_MISC,
+		"// gg_session_handle_magic_notification \n");
+
+	gg_protobuf_expected(gs, "GG110MagicNotification.dummy1", msg->dummy1, 2);
+	gg_protobuf_expected(gs, "GG110MagicNotification.dummy2", msg->dummy2, 1);
+	gg_protobuf_expected(gs, "GG110MagicNotification.dummy3", msg->dummy3, 1);
+
+	succ = (gg_ack_110(gs, GG110_ACK__TYPE__MAGIC_NOTIFICATION, msg->seq, ge) == 0);
+
+	gg110_magic_notification__free_unpacked(msg, NULL);
+
+	return succ ? 0 : -1;
+}
+
 /**
  * \internal Tablica obsługiwanych pakietów
  */
@@ -2749,7 +2790,7 @@ static const gg_packet_handler_t handler
 	{ GG_USERLIST100_VERSION, GG_STATE_CONNECTED, sizeof(struct gg_userlist100_version), gg_session_handle_userlist_100_version },
 	{ GG_USERLIST100_REPLY, GG_STATE_CONNECTED, sizeof(struct gg_userlist100_reply), gg_session_handle_userlist_100_reply },
 	{ GG_IMTOKEN, GG_STATE_CONNECTED, 0, gg_session_handle_imtoken },
-	{ GG_PONG110, GG_STATE_CONNECTED, sizeof(struct gg_pong110), gg_session_handle_pong_110 },
+	{ GG_PONG110, GG_STATE_CONNECTED, 0, gg_session_handle_pong_110 },
 	{ GG_CHAT_INFO, GG_STATE_CONNECTED, 0, gg_session_handle_chat_info },
 	{ GG_CHAT_INFO_UPDATE, GG_STATE_CONNECTED, 0, gg_session_handle_chat_info_update },
 	{ GG_CHAT_CREATED, GG_STATE_CONNECTED, sizeof(struct gg_chat_created), gg_session_handle_chat_created },
@@ -2760,7 +2801,8 @@ static const gg_packet_handler_t handler
 	{ GG_OPTIONS, GG_STATE_CONNECTED, 0, gg_session_handle_options },
 	{ GG_ACCESS_INFO, GG_STATE_CONNECTED, 0, gg_session_handle_access_info },
 	{ GG_UIN_INFO, GG_STATE_CONNECTED, 0, gg_session_handle_uin_info },
-	{ GG_TRANSFER_INFO, GG_STATE_CONNECTED, 0, gg_session_handle_transfer_info }
+	{ GG_TRANSFER_INFO, GG_STATE_CONNECTED, 0, gg_session_handle_transfer_info },
+	{ GG_MAGIC_NOTIFICATION, GG_STATE_CONNECTED, 0, gg_session_handle_magic_notification }
 	/* style:maxlinelength:end-ignore */
 };
 
diff --git a/libpurple/protocols/gg/lib/libgadu.c b/libpurple/protocols/gg/lib/libgadu.c
--- a/libpurple/protocols/gg/lib/libgadu.c
+++ b/libpurple/protocols/gg/lib/libgadu.c
@@ -2123,7 +2123,6 @@ int gg_image_reply(struct gg_session *se
 	struct gg_send_msg s;
 	const char *tmp;
 	char buf[1910];
-	int res = -1;
 	gg_imgout_queue_t *queue = NULL, *queue_end = NULL;
 
 	gg_debug_session(sess, GG_DEBUG_FUNCTION, "** gg_image_reply(%p, %d, "
@@ -2212,7 +2211,7 @@ int gg_image_reply(struct gg_session *se
 	}
 	gg_image_sendout(sess);
 
-	return res;
+	return 0;
 }
 
 void gg_image_sendout(struct gg_session *sess)
diff --git a/libpurple/protocols/gg/lib/packets.pb-c.c b/libpurple/protocols/gg/lib/packets.pb-c.c
--- a/libpurple/protocols/gg/lib/packets.pb-c.c
+++ b/libpurple/protocols/gg/lib/packets.pb-c.c
@@ -1,8 +1,9 @@
 /* Generated by the protocol buffer compiler.  DO NOT EDIT! */
+/* Generated from: packets.proto */
 
 /* Do not generate deprecated warnings for self */
-#ifndef PROTOBUF_C_NO_DEPRECATED
-#define PROTOBUF_C_NO_DEPRECATED
+#ifndef PROTOBUF_C__NO_DEPRECATED
+#define PROTOBUF_C__NO_DEPRECATED
 #endif
 
 #include "packets.pb-c.h"
@@ -15,21 +16,21 @@ void   gg110_login_ok__init
 size_t gg110_login_ok__get_packed_size
                      (const GG110LoginOK *message)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &gg110_login_ok__descriptor);
+  assert(message->base.descriptor == &gg110_login_ok__descriptor);
   return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
 }
 size_t gg110_login_ok__pack
                      (const GG110LoginOK *message,
                       uint8_t       *out)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &gg110_login_ok__descriptor);
+  assert(message->base.descriptor == &gg110_login_ok__descriptor);
   return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);



More information about the Commits mailing list