aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/jabber.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-02-18 22:45:39 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2007-02-18 22:45:39 +0000
commit0f4c1bb59f2c939cabddd02e226954a3cfa02a7b (patch)
treea095e5a4a103882cfbc0b1de14d43822d0e109eb /protocols/jabber/jabber.c
parent0fd8559c4a6ad84ad0852e07c4ba2e50b2fdf0ad (diff)
Added Jabber server port number restrictions.
Diffstat (limited to 'protocols/jabber/jabber.c')
-rw-r--r--protocols/jabber/jabber.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index a60cd4aa..fa9c3473 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -36,7 +36,7 @@ static void jabber_acc_init( account_t *acc )
{
set_t *s;
- s = set_add( &acc->set, "port", "5222", set_eval_int, acc );
+ s = set_add( &acc->set, "port", JABBER_PORT_DEFAULT, set_eval_int, acc );
s->flags |= ACC_SET_OFFLINE_ONLY;
s = set_add( &acc->set, "priority", "0", set_eval_priority, acc );
@@ -160,6 +160,15 @@ static void jabber_login( account_t *acc )
set_login_progress( gc, 0, "Connecting" );
+ if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN ||
+ set_getint( &acc->set, "port" ) > JABBER_PORT_MAX )
+ {
+ serv_got_crap( gc, "Incorrect port number, must be in the %d-%d range",
+ JABBER_PORT_MIN, JABBER_PORT_MAX );
+ signoff( gc );
+ return;
+ }
+
/* For non-SSL connections we can try to use the port # from the SRV
reply, but let's not do that when using SSL, SSL usually runs on
non-standard ports... */