Ignore:
Timestamp:
2006-09-22T18:39:31Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d8e0484
Parents:
8d74291
Message:

Better detection of successful IQ authentication (using packet caching),
properly working SASL authentication (although only PLAIN so far).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/io.c

    r8d74291 rfe7a554  
    219219        struct gaim_connection *gc = data;
    220220        struct jabber_data *jd = gc->proto_data;
    221         struct xt_node *c;
     221        struct xt_node *c, *reply;
    222222       
    223223        c = xt_find_node( node->children, "starttls" );
     
    231231        }
    232232       
     233        if( ( c = xt_find_node( node->children, "bind" ) ) )
     234        {
     235                reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &gc->acc->set, "resource" ), NULL ) );
     236                xt_add_attr( reply, "xmlns", "urn:ietf:params:xml:ns:xmpp-bind" );
     237                reply = jabber_make_packet( "iq", "set", NULL, reply );
     238                jabber_cache_packet( gc, reply );
     239               
     240                if( !jabber_write_packet( gc, reply ) )
     241                        return XT_ABORT;
     242               
     243                jd->flags |= JFLAG_WAIT_BIND;
     244        }
     245       
     246        if( ( c = xt_find_node( node->children, "session" ) ) )
     247        {
     248                reply = xt_new_node( "session", NULL, NULL );
     249                xt_add_attr( reply, "xmlns", "urn:ietf:params:xml:ns:xmpp-session" );
     250                reply = jabber_make_packet( "iq", "set", NULL, reply );
     251                jabber_cache_packet( gc, reply );
     252               
     253                if( !jabber_write_packet( gc, reply ) )
     254                        return XT_ABORT;
     255               
     256                jd->flags |= JFLAG_WAIT_SESSION;
     257        }
     258       
    233259        /* This flag is already set if we authenticated via SASL, so now
    234            we can resume the session in the new stream. */
    235         if( jd->flags & JFLAG_AUTHENTICATED )
     260           we can resume the session in the new stream, if we don't have
     261           to bind/initialize the session. */
     262        if( jd->flags & JFLAG_AUTHENTICATED && ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
    236263        {
    237264                if( !jabber_get_roster( gc ) )
Note: See TracChangeset for help on using the changeset viewer.