Ignore:
Timestamp:
2010-03-14T23:15:05Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
81ee561
Parents:
7c5affca (diff), 7e2b593 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging in head.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/io.c

    r7c5affca r3330468  
    375375       
    376376        if( ( c = xt_find_node( node->children, "bind" ) ) )
    377         {
    378                 reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
    379                 xt_add_attr( reply, "xmlns", XMLNS_BIND );
    380                 reply = jabber_make_packet( "iq", "set", NULL, reply );
    381                 jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
    382                
    383                 if( !jabber_write_packet( ic, reply ) )
    384                         return XT_ABORT;
    385                
    386                 jd->flags |= JFLAG_WAIT_BIND;
    387         }
     377                jd->flags |= JFLAG_WANT_BIND;
    388378       
    389379        if( ( c = xt_find_node( node->children, "session" ) ) )
    390         {
    391                 reply = xt_new_node( "session", NULL, NULL );
    392                 xt_add_attr( reply, "xmlns", XMLNS_SESSION );
    393                 reply = jabber_make_packet( "iq", "set", NULL, reply );
    394                 jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
    395                
    396                 if( !jabber_write_packet( ic, reply ) )
    397                         return XT_ABORT;
    398                
    399                 jd->flags |= JFLAG_WAIT_SESSION;
    400         }
     380                jd->flags |= JFLAG_WANT_SESSION;
    401381       
    402382        /* This flag is already set if we authenticated via SASL, so now
    403383           we can resume the session in the new stream, if we don't have
    404384           to bind/initialize the session. */
    405         if( jd->flags & JFLAG_AUTHENTICATED && ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
     385        if( jd->flags & JFLAG_AUTHENTICATED && ( jd->flags & ( JFLAG_WANT_BIND | JFLAG_WANT_SESSION ) ) == 0 )
    406386        {
    407387                if( !jabber_get_roster( ic ) )
    408388                        return XT_ABORT;
     389        }
     390        else if( jd->flags & JFLAG_AUTHENTICATED )
     391        {
     392                return jabber_pkt_bind_sess( ic, NULL, NULL );
    409393        }
    410394       
     
    441425        imcb_log( ic, "Converting stream to TLS" );
    442426       
     427        jd->flags |= JFLAG_STARTTLS_DONE;
    443428        jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, ic );
    444429       
     
    531516                jd->r_inpa = b_input_add( jd->fd, B_EV_IO_READ, jabber_read_callback, ic );
    532517       
    533         greet = g_strdup_printf( "<?xml version='1.0' ?>"
    534                                  "<stream:stream to=\"%s\" xmlns=\"jabber:client\" "
    535                                   "xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">", jd->server );
     518        greet = g_strdup_printf( "%s<stream:stream to=\"%s\" xmlns=\"jabber:client\" "
     519                                  "xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">",
     520                                  ( jd->flags & JFLAG_STARTTLS_DONE ) ? "" : "<?xml version='1.0' ?>",
     521                                  jd->server );
    536522       
    537523        st = jabber_write( ic, greet, strlen( greet ) );
Note: See TracChangeset for help on using the changeset viewer.