From 315dd4c1566dcd4caa9c4ca0eceeceb995a01443 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 15 Mar 2010 01:25:47 +0000 Subject: Oops.. Today's Jabber fix could get stuck in a somewhat infinite loop if a Jabber server returns an empty response to the session establishment request (which is valid and actually done by the example, but my test Jabberd shows different behaviour). Fixed. --- protocols/jabber/io.c | 12 +----------- protocols/jabber/iq.c | 8 ++------ 2 files changed, 3 insertions(+), 17 deletions(-) (limited to 'protocols/jabber') diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c index 4a790f27..a14ad21c 100644 --- a/protocols/jabber/io.c +++ b/protocols/jabber/io.c @@ -379,18 +379,8 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data ) if( ( c = xt_find_node( node->children, "session" ) ) ) jd->flags |= JFLAG_WANT_SESSION; - /* This flag is already set if we authenticated via SASL, so now - we can resume the session in the new stream, if we don't have - to bind/initialize the session. */ - if( jd->flags & JFLAG_AUTHENTICATED && ( jd->flags & ( JFLAG_WANT_BIND | JFLAG_WANT_SESSION ) ) == 0 ) - { - if( !jabber_get_roster( ic ) ) - return XT_ABORT; - } - else if( jd->flags & JFLAG_AUTHENTICATED ) - { + if( jd->flags & JFLAG_AUTHENTICATED ) return jabber_pkt_bind_sess( ic, NULL, NULL ); - } return XT_HANDLED; } diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 21e52da6..1b76a761 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -306,23 +306,19 @@ xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, if( c && c->text_len && ( s = strchr( c->text, '/' ) ) && strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 ) imcb_log( ic, "Server changed session resource string to `%s'", s + 1 ); - - jd->flags &= ~JFLAG_WANT_BIND; - } - else if( node && ( c = xt_find_node( node->children, "session" ) ) ) - { - jd->flags &= ~JFLAG_WANT_SESSION; } if( jd->flags & JFLAG_WANT_BIND ) { reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) ); xt_add_attr( reply, "xmlns", XMLNS_BIND ); + jd->flags &= ~JFLAG_WANT_BIND; } else if( jd->flags & JFLAG_WANT_SESSION ) { reply = xt_new_node( "session", NULL, NULL ); xt_add_attr( reply, "xmlns", XMLNS_SESSION ); + jd->flags &= ~JFLAG_WANT_SESSION; } if( reply != NULL ) -- cgit v1.2.3