im.pidgin.pidgin.2.2.3: 524f26ace3ac354430ac04a95b8d1c149f09b02a

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Fri Nov 9 13:27:55 EST 2007


-----------------------------------------------------------------
Revision: 524f26ace3ac354430ac04a95b8d1c149f09b02a
Ancestor: 1a134c1150b507c3505ee1c948644ff0831d62d2
Author: rekkanoryo at pidgin.im
Date: 2007-11-09T08:33:47
Branch: im.pidgin.pidgin.2.2.3

Modified files:
        libpurple/protocols/silc/buddy.c
        libpurple/protocols/silc10/buddy.c
        libpurple/protocols/simple/simple.c
        libpurple/protocols/simple/simple.h
        libpurple/protocols/simple/sipmsg.c
        libpurple/protocols/simple/sipmsg.h

ChangeLog: 

applied changes from 20395453ab17cd8dd060d4d0794affda17e3272f
             through 3a8a65c746e023953f147a9069128a4df23e97bf

-------------- next part --------------
============================================================
--- libpurple/protocols/silc/buddy.c	b55bff4f2d31c3effaa2f094380c60435656e3f5
+++ libpurple/protocols/silc/buddy.c	64cd6b56d67dab2995b54587f6ecb605fb431a55
@@ -934,8 +934,11 @@ silcpurple_add_buddy_save(SilcBool succe
 		/* Create dir if it doesn't exist */
 		if ((g_stat(filename, &st)) == -1) {
 			if (errno == ENOENT) {
-				if (pw->pw_uid == geteuid())
-					g_mkdir(filename, 0755);
+				if (pw->pw_uid == geteuid()) {
+					int ret = g_mkdir(filename, 0755);
+					if (ret < 0)
+						return;
+					}
 			}
 		}
 
============================================================
--- libpurple/protocols/silc10/buddy.c	f5e9ea03467d941e8315fa19d759d8f94b857ce6
+++ libpurple/protocols/silc10/buddy.c	9efd8b9cc41ff4a4518bd195204a2d6bf9882fa5
@@ -939,8 +939,11 @@ silcpurple_add_buddy_save(bool success, 
 		/* Create dir if it doesn't exist */
 		if ((g_stat(filename, &st)) == -1) {
 			if (errno == ENOENT) {
-				if (pw->pw_uid == geteuid())
-					g_mkdir(filename, 0755);
+				if (pw->pw_uid == geteuid()) {
+					int ret = g_mkdir(filename, 0755);
+					if (ret < 0)
+						return;
+				}
 			}
 		}
 
============================================================
--- libpurple/protocols/simple/simple.c	5fc19ea989d4a8abc949c6f88b4dd4244019b304
+++ libpurple/protocols/simple/simple.c	00d0e300f695d4ac85700eea3af76713db10f666
@@ -321,7 +321,7 @@ static char *parse_attribute(const char 
 	return retval;
 }
 
-static void fill_auth(struct simple_account_data *sip, gchar *hdr, struct sip_auth *auth) {
+static void fill_auth(struct simple_account_data *sip, const gchar *hdr, struct sip_auth *auth) {
 	int i = 0;
 	const char *authuser;
 	char *tmp;
@@ -592,7 +592,7 @@ static struct transaction *transactions_
 static struct transaction *transactions_find(struct simple_account_data *sip, struct sipmsg *msg) {
 	struct transaction *trans;
 	GSList *transactions = sip->transactions;
-	gchar *cseq = sipmsg_find_header(msg, "CSeq");
+	const gchar *cseq = sipmsg_find_header(msg, "CSeq");
 
 	if (cseq) {
 		while(transactions) {
@@ -800,7 +800,7 @@ static gboolean simple_add_lcs_contacts(
 }
 
 static gboolean simple_add_lcs_contacts(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) {
-	gchar *tmp;
+	const gchar *tmp;
 	xmlnode *item, *group, *isc;
 	const char *name_group;
 	PurpleBuddy *b;
@@ -960,7 +960,7 @@ static void process_incoming_message(str
 
 static void process_incoming_message(struct simple_account_data *sip, struct sipmsg *msg) {
 	gchar *from;
-	gchar *contenttype;
+	const gchar *contenttype;
 	gboolean found = FALSE;
 
 	from = parse_from(sipmsg_find_header(msg, "From"));
@@ -1015,7 +1015,7 @@ gboolean process_register_response(struc
 
 
 gboolean process_register_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) {
-	gchar *tmp;
+	const gchar *tmp;
 	purple_debug(PURPLE_DEBUG_MISC, "simple", "in process register response response: %d\n", msg->response);
 	switch (msg->response) {
 		case 200:
@@ -1070,7 +1070,7 @@ static void process_incoming_notify(stru
 
 static void process_incoming_notify(struct simple_account_data *sip, struct sipmsg *msg) {
 	gchar *from;
-	gchar *fromhdr;
+	const gchar *fromhdr;
 	gchar *basicstatus_data;
 	xmlnode *pidf;
 	xmlnode *basicstatus = NULL, *tuple, *status;
@@ -1253,8 +1253,8 @@ static void process_incoming_subscribe(s
 	gchar *theirtag = find_tag(from_hdr);
 	gchar *ourtag = find_tag(sipmsg_find_header(msg, "To"));
 	gboolean tagadded = FALSE;
-	gchar *callid = sipmsg_find_header(msg, "Call-ID");
-	gchar *expire = sipmsg_find_header(msg, "Expire");
+	const gchar *callid = sipmsg_find_header(msg, "Call-ID");
+	const gchar *expire = sipmsg_find_header(msg, "Expire");
 	gchar *tmp;
 	struct simple_watcher *watcher = watcher_find(sip, from);
 	if(!ourtag) {
@@ -1262,14 +1262,14 @@ static void process_incoming_subscribe(s
 		ourtag = gentag();
 	}
 	if(!watcher) { /* new subscription */
-		gchar *acceptheader = sipmsg_find_header(msg, "Accept");
+		const gchar *acceptheader = sipmsg_find_header(msg, "Accept");
 		gboolean needsxpidf = FALSE;
 		if(!purple_privacy_check(sip->account, from)) {
 			send_sip_response(sip->gc, msg, 202, "Ok", NULL);
 			goto privend;
 		}
 		if(acceptheader) {
-			gchar *tmp = acceptheader;
+			const gchar *tmp = acceptheader;
 			gboolean foundpidf = FALSE;
 			gboolean foundxpidf = FALSE;
 			while(tmp && tmp < acceptheader + strlen(acceptheader)) {
@@ -1287,7 +1287,6 @@ static void process_incoming_subscribe(s
 					tmp = 0;
 			}
 			if(!foundpidf && foundxpidf) needsxpidf = TRUE;
-			g_free(acceptheader);
 		}
 		watcher = watcher_create(sip, from, callid, ourtag, theirtag, needsxpidf);
 	}
@@ -1312,8 +1311,6 @@ privend:
 	g_free(from);
 	g_free(theirtag);
 	g_free(ourtag);
-	g_free(callid);
-	g_free(expire);
 }
 
 static void process_input_message(struct simple_account_data *sip, struct sipmsg *msg) {
@@ -1335,7 +1332,8 @@ static void process_input_message(struct
 		struct transaction *trans = transactions_find(sip, msg);
 		if(trans) {
 			if(msg->response == 407) {
-				gchar *resend, *auth, *ptmp;
+				gchar *resend, *auth;
+				const gchar *ptmp;
 
 				if(sip->proxy.retries > 3) return;
 				sip->proxy.retries++;
@@ -1379,7 +1377,8 @@ static void process_input_message(struct
 							/* This is encountered when a generic (MESSAGE, NOTIFY, etc)
 							 * was denied until further authorization is provided.
 							 */
-							gchar *resend, *auth, *ptmp;
+							gchar *resend, *auth;
+							const gchar *ptmp;
 
 							if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) return;
 							sip->registrar.retries++;
============================================================
--- libpurple/protocols/simple/simple.h	502d503c44e90e5b9c7f9591401936247c4d1353
+++ libpurple/protocols/simple/simple.h	fd2b60ab061bbb8ca0851d34124fcccb75d17113
@@ -127,7 +127,7 @@ struct transaction {
 	int retries;
 	int transport; /* 0 = tcp, 1 = udp */
 	int fd;
-	gchar *cseq;
+	const gchar *cseq;
 	struct sipmsg *msg;
 	TransCallback callback;
 };
============================================================
--- libpurple/protocols/simple/sipmsg.c	83bb87bf8d3fe9639e9ffbfe82fd797b206b1a6e
+++ libpurple/protocols/simple/sipmsg.c	60021dd8200e0ea65ee3e0c9a4db915fa96176be
@@ -58,6 +58,7 @@ struct sipmsg *sipmsg_parse_header(const
 	gchar *dummy;
 	gchar *dummy2;
 	gchar *tmp;
+	const gchar *tmp2;
 	int i=1;
 	if(!lines[0]) return NULL;
 	parts = g_strsplit(lines[0], " ", 3);
@@ -100,14 +101,16 @@ struct sipmsg *sipmsg_parse_header(const
 		g_strfreev(parts);
 	}
 	g_strfreev(lines);
-	msg->bodylen = strtol(sipmsg_find_header(msg, "Content-Length"),NULL,10);
+	tmp2 = sipmsg_find_header(msg, "Content-Length");
+	if (tmp2 != NULL)
+		msg->bodylen = strtol(tmp2, NULL, 10);
 	if(msg->response) {
-		tmp = sipmsg_find_header(msg, "CSeq");
-		if(!tmp) {
+		tmp2 = sipmsg_find_header(msg, "CSeq");
+		if(!tmp2) {
 			/* SHOULD NOT HAPPEN */
 			msg->method = 0;
 		} else {
-			parts = g_strsplit(tmp, " ", 2);
+			parts = g_strsplit(tmp2, " ", 2);
 			msg->method = g_strdup(parts[1]);
 			g_strfreev(parts);
 		}
@@ -192,7 +195,7 @@ void sipmsg_remove_header(struct sipmsg 
 	return;
 }
 
-gchar *sipmsg_find_header(struct sipmsg *msg, const gchar *name) {
+const gchar *sipmsg_find_header(struct sipmsg *msg, const gchar *name) {
 	GSList *tmp;
 	struct siphdrelement *elem;
 	tmp = msg->headers;
============================================================
--- libpurple/protocols/simple/sipmsg.h	f1a413086a51e2c5fea2f3a3ffe647a65d4d185b
+++ libpurple/protocols/simple/sipmsg.h	feb4377691f964e3a45fffd6d4f13141ea9d1251
@@ -43,7 +43,7 @@ void sipmsg_free(struct sipmsg *msg);
 struct sipmsg *sipmsg_parse_header(const gchar *header);
 void sipmsg_add_header(struct sipmsg *msg, const gchar *name, const gchar *value);
 void sipmsg_free(struct sipmsg *msg);
-gchar *sipmsg_find_header(struct sipmsg *msg, const gchar *name);
+const gchar *sipmsg_find_header(struct sipmsg *msg, const gchar *name);
 void sipmsg_remove_header(struct sipmsg *msg, const gchar *name);
 void sipmsg_print(const struct sipmsg *msg);
 char *sipmsg_to_string(const struct sipmsg *msg);


More information about the Commits mailing list