aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/jabber.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/jabber/jabber.c')
-rw-r--r--protocols/jabber/jabber.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index 413f77ef..fc419124 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 <sys/utsname.h>
#endif
@@ -58,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"
@@ -540,11 +538,6 @@ static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition c
struct jabber_data *jd;
gjconn gjc;
- if (!g_slist_find(get_connections(), gc)) {
- ssl_disconnect(source);
- return;
- }
-
jd = gc->proto_data;
gjc = jd->gjc;
@@ -553,6 +546,11 @@ static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition c
return;
}
+ if (!g_slist_find(get_connections(), gc)) {
+ ssl_disconnect(source);
+ return;
+ }
+
gjab_connected(data, gjc->fd, cond);
}
@@ -588,6 +586,11 @@ static void gjab_start(gjconn gjc)
port = DEFAULT_PORT;
else if (port == -1 && ssl)
port = DEFAULT_PORT_SSL;
+ 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;
+ }
if (server == NULL)
server = g_strdup(gjc->user->server);