aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/jabber.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-12-04 22:55:15 +0100
committerJelmer Vernooij <jelmer@samba.org>2005-12-04 22:55:15 +0100
commit019c031a8d77fa8f21792ccf0e07c2dfa058ce5f (patch)
tree116b7dc98dc8b4d4805a02f7e5d4ce64c95b9eac /protocols/jabber/jabber.c
parent500a1b60d3dd0565d215721e0db7ec7da2dec2e0 (diff)
parentd636233a518fbe46264230866d4b8ea463f1474e (diff)
Merge from Wilmer
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);