From c7cf9d6f811e299c3659350c6bd21c75ba249de5 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 29 Nov 2005 01:43:15 +0100 Subject: This should fix a crash bug in Jabber module (NULL pointer dereference on broken Jabber/SSL connections). --- protocols/jabber/jabber.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'protocols') diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index d8d77a36..b6fca9b2 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -545,6 +545,11 @@ static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition c struct jabber_data *jd; gjconn gjc; + if (source == NULL) { + STATE_EVT(JCONN_STATE_OFF) + return; + } + if (!g_slist_find(get_connections(), gc)) { ssl_disconnect(source); return; @@ -553,11 +558,6 @@ static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition c jd = gc->proto_data; gjc = jd->gjc; - if (source == NULL) { - STATE_EVT(JCONN_STATE_OFF) - return; - } - gjab_connected(data, gjc->fd, cond); } -- cgit v1.2.3 From c3c2e1403287380e5e9d520900f761bbfa738b9f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 30 Nov 2005 13:12:25 +0100 Subject: Got rid of the config.h includes in IM-code. Now that HAVE_CONFIG_H is defined, they started to cause problems. --- protocols/jabber/jabber.c | 4 ---- protocols/yahoo/crypt.c | 4 ---- protocols/yahoo/libyahoo2.c | 4 ---- protocols/yahoo/yahoo_httplib.c | 4 ---- protocols/yahoo/yahoo_util.c | 4 ---- 5 files changed, 20 deletions(-) (limited to 'protocols') diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index b6fca9b2..0379e2d3 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifndef _WIN32 #include #endif diff --git a/protocols/yahoo/crypt.c b/protocols/yahoo/crypt.c index 00eed70b..5122e3af 100644 --- a/protocols/yahoo/crypt.c +++ b/protocols/yahoo/crypt.c @@ -22,10 +22,6 @@ * already had. isn't that lovely. people should just use linux or * freebsd, crypt works properly on those systems. i hate solaris */ -#if HAVE_CONFIG_H -# include -#endif - #if HAVE_STRING_H # include #elif HAVE_STRINGS_H diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index 62ceb0af..c691f18b 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -43,10 +43,6 @@ * */ -#if HAVE_CONFIG_H -# include -#endif - #ifndef _WIN32 #include #endif diff --git a/protocols/yahoo/yahoo_httplib.c b/protocols/yahoo/yahoo_httplib.c index 41e31a23..dbbe2a84 100644 --- a/protocols/yahoo/yahoo_httplib.c +++ b/protocols/yahoo/yahoo_httplib.c @@ -19,10 +19,6 @@ * */ -#if HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/protocols/yahoo/yahoo_util.c b/protocols/yahoo/yahoo_util.c index cb155e3c..3c99cf44 100644 --- a/protocols/yahoo/yahoo_util.c +++ b/protocols/yahoo/yahoo_util.c @@ -19,10 +19,6 @@ * */ -#if HAVE_CONFIG_H -# include -#endif - #if STDC_HEADERS # include #else -- cgit v1.2.3 From 6caa56ab8e53f3b954da2ad1bbc779bfba1737ed Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 30 Nov 2005 14:36:59 +0100 Subject: Renamed no_one_calls in proxy.c to something that makes more sense to me. --- protocols/proxy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'protocols') diff --git a/protocols/proxy.c b/protocols/proxy.c index 59b480f4..fb87e356 100644 --- a/protocols/proxy.c +++ b/protocols/proxy.c @@ -123,7 +123,7 @@ static gboolean gaim_io_invoke(GIOChannel *source, GIOCondition condition, gpoin return TRUE; } -static void no_one_calls(gpointer data, gint source, GaimInputCondition cond) +static void gaim_io_connected(gpointer data, gint source, GaimInputCondition cond) { struct PHB *phb = data; unsigned int len; @@ -172,7 +172,7 @@ static int proxy_connect_none(char *host, unsigned short port, struct PHB *phb) if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) { if (sockerr_again()) { - phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, no_one_calls, phb); + phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb); phb->fd = fd; } else { closesocket(fd); -- cgit v1.2.3 From 7c2d798b79041108ae71f86e7dbfdf9bf984dcb0 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 1 Dec 2005 12:52:25 +0100 Subject: jabber.c:542: warning: `gjc' might be used uninitialized in this function --- protocols/jabber/jabber.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'protocols') diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 0379e2d3..16755d99 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -541,6 +541,9 @@ static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition c struct jabber_data *jd; gjconn gjc; + jd = gc->proto_data; + gjc = jd->gjc; + if (source == NULL) { STATE_EVT(JCONN_STATE_OFF) return; @@ -551,9 +554,6 @@ static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition c return; } - jd = gc->proto_data; - gjc = jd->gjc; - gjab_connected(data, gjc->fd, cond); } -- cgit v1.2.3 From 626b446e0a4f10fbcf38661013a592bcd3193e08 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 2 Dec 2005 12:30:03 +0100 Subject: The Jabber module now only accepts a limited range of ports (5222 and 5223), so it can't be abused as a portscanner. Thanks to Peter van Dijk (Habbie) for the report. --- protocols/jabber/jabber.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'protocols') diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 16755d99..e7703b44 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -589,6 +589,11 @@ static void gjab_start(gjconn gjc) port = DEFAULT_PORT; else if (port == -1 && ssl) port = DEFAULT_PORT_SSL; + else if (port != 5222 && port != 5223) { + serv_got_crap(GJ_GC(gjc), "Only port numbers 5222 and 5223 are allowed for Jabber connections."); + STATE_EVT(JCONN_STATE_OFF) + return; + } if (server == NULL) server = g_strdup(gjc->user->server); -- cgit v1.2.3 From 027d2ebf750a011bf544f7d279cfb706594e5d05 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 2 Dec 2005 12:43:47 +0100 Subject: Modified CHANGES, and extended the allowed port range a bit. --- protocols/jabber/jabber.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'protocols') diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index e7703b44..535607e6 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -54,6 +54,8 @@ #define DEFAULT_GROUPCHAT "conference.jabber.org" #define DEFAULT_PORT 5222 #define DEFAULT_PORT_SSL 5223 +#define JABBER_PORT_MIN 5220 +#define JABBER_PORT_MAX 5229 #define JABBER_GROUP "Friends" @@ -589,8 +591,8 @@ static void gjab_start(gjconn gjc) port = DEFAULT_PORT; else if (port == -1 && ssl) port = DEFAULT_PORT_SSL; - else if (port != 5222 && port != 5223) { - serv_got_crap(GJ_GC(gjc), "Only port numbers 5222 and 5223 are allowed for Jabber connections."); + else if (port < JABBER_PORT_MIN || port > JABBER_PORT_MAX) { + serv_got_crap(GJ_GC(gjc), "For security reasons, the Jabber port number must be in the %d-%d range.", JABBER_PORT_MIN, JABBER_PORT_MAX); STATE_EVT(JCONN_STATE_OFF) return; } -- cgit v1.2.3 From f1df064766075ac2f36fb4027a4a683964f3be9a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 3 Dec 2005 00:41:57 +0100 Subject: Oops... A very small typo caused very weird problems in the line splitting code. --- protocols/nogaim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 101cbb14..d0676201 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -665,7 +665,7 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f /* If there's a newline/space in this string, split up there, looks a bit prettier. */ - if( ( nl = strrchr( msg, '\n' ) ) || ( nl = strchr( msg, ' ' ) ) ) + if( ( nl = strrchr( msg, '\n' ) ) || ( nl = strrchr( msg, ' ' ) ) ) { msg[425] = tmp; tmp = *nl; -- cgit v1.2.3 From 25d1be7fbfe217b756861b4306ff7a5ae77becb1 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 4 Dec 2005 01:48:57 +0100 Subject: do_error_dialog shouldn't do NULL dereferences anymore, and TYPING notifications are always direct PRIVMSGs. --- protocols/nogaim.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'protocols') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index d0676201..5fbe00ab 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -380,7 +380,14 @@ void signoff( struct gaim_connection *gc ) void do_error_dialog( struct gaim_connection *gc, char *msg, char *title ) { - serv_got_crap( gc, "Error: %s", msg ); + if( msg && title ) + serv_got_crap( gc, "Error: %s: %s", title, msg ); + else if( msg ) + serv_got_crap( gc, "Error: %s", msg ); + else if( title ) + serv_got_crap( gc, "Error: %s", title ); + else + serv_got_crap( gc, "Error" ); } void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont ) @@ -697,7 +704,7 @@ void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout ) return; if( ( u = user_findhandle( gc, handle ) ) ) - irc_msgfrom( gc->irc, u->nick, "\1TYPING 1\1" ); + irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, "\1TYPING \1" ); } void serv_got_chat_left( struct gaim_connection *gc, int id ) -- cgit v1.2.3 From d636233a518fbe46264230866d4b8ea463f1474e Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 4 Dec 2005 16:12:32 +0100 Subject: Oops... :-( --- protocols/nogaim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 5fbe00ab..3ab4737e 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -704,7 +704,7 @@ void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout ) return; if( ( u = user_findhandle( gc, handle ) ) ) - irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, "\1TYPING \1" ); + irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, "\1TYPING 1\1" ); } void serv_got_chat_left( struct gaim_connection *gc, int id ) -- cgit v1.2.3