Changeset 7f69740


Ignore:
Timestamp:
2008-06-15T18:11:47Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d419073
Parents:
5ec4129
Message:

Using a port list instead of a single range for the allowed Jabber port
numbers, adding 80 and 443. Partially closes #265.

Location:
protocols/jabber
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    r5ec4129 r7f69740  
    3737GSList *jabber_connections;
    3838
     39/* First enty is the default */
     40static const int jabber_port_list[] = {
     41        5222,
     42        5223,
     43        5220,
     44        5221,
     45        5224,
     46        5225,
     47        5226,
     48        5227,
     49        5228,
     50        5229,
     51        80,
     52        443,
     53        0
     54};
     55
    3956static void jabber_init( account_t *acc )
    4057{
    4158        set_t *s;
    42        
    43         s = set_add( &acc->set, "port", JABBER_PORT_DEFAULT, set_eval_int, acc );
     59        char str[16];
     60       
     61        g_snprintf( str, sizeof( str ), "%d", jabber_port_list[0] );
     62        s = set_add( &acc->set, "port", str, set_eval_int, acc );
    4463        s->flags |= ACC_SET_OFFLINE_ONLY;
    4564       
     
    7291        struct ns_srv_reply *srv = NULL;
    7392        char *connect_to, *s;
     93        int i;
    7494       
    7595        /* For now this is needed in the _connected() handlers if using
     
    177197        imcb_log( ic, "Connecting" );
    178198       
    179         if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN ||
    180             set_getint( &acc->set, "port" ) > JABBER_PORT_MAX )
    181         {
    182                 imcb_log( ic, "Incorrect port number, must be in the %d-%d range",
    183                                JABBER_PORT_MIN, JABBER_PORT_MAX );
     199        for( i = 0; jabber_port_list[i] > 0; i ++ )
     200                if( set_getint( &acc->set, "port" ) == jabber_port_list[i] )
     201                        break;
     202
     203        if( jabber_port_list[i] == 0 )
     204        {
     205                imcb_log( ic, "Illegal port number" );
    184206                imc_logout( ic, FALSE );
    185207                return;
  • protocols/jabber/jabber.h

    r5ec4129 r7f69740  
    134134
    135135#define JABBER_XMLCONSOLE_HANDLE "xmlconsole"
    136 
    137 #define JABBER_PORT_DEFAULT "5222"
    138 #define JABBER_PORT_MIN 5220
    139 #define JABBER_PORT_MAX 5229
    140136
    141137/* Prefixes to use for packet IDs (mainly for IQ packets ATM). Usually the
Note: See TracChangeset for help on using the changeset viewer.