diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-09-22 18:56:58 +0200 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-09-22 18:56:58 +0200 | 
| commit | 8d7429102adf8dce6844f2f3da2723d1f87c6442 (patch) | |
| tree | 78a178e4798f8f11ac5590137efc0642aeea6378 /protocols/jabber/sasl.c | |
| parent | 59974884ba72d6e8fa008d07ee93bd228d30a99c (diff) | |
Fixed return value on incomplete write()s in write handler, protection
against write()ing to sockets that are closed already, hopefully sane
detection for SASL support, and only sending type=unavailable presence
tag to logged in sessions.
Diffstat (limited to 'protocols/jabber/sasl.c')
| -rw-r--r-- | protocols/jabber/sasl.c | 20 | 
1 files changed, 20 insertions, 0 deletions
| diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c index da577877..2f75e733 100644 --- a/protocols/jabber/sasl.c +++ b/protocols/jabber/sasl.c @@ -34,6 +34,15 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )  	char *s;  	int sup_plain = 0, sup_digest = 0; +	if( !sasl_supported( gc ) ) +	{ +		/* Should abort this now, since we should already be doing +		   IQ authentication. Strange things happen when you try +		   to do both... */ +		serv_got_crap( gc, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" ); +		return XT_HANDLED; +	} +	  	s = xt_find_attr( node, "xmlns" );  	if( !s || strcmp( s, SASL_NS ) != 0 )  	{ @@ -93,6 +102,7 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )  xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data )  { +	return XT_HANDLED;  }  xt_status sasl_pkt_result( struct xt_node *node, gpointer data ) @@ -122,3 +132,13 @@ xt_status sasl_pkt_result( struct xt_node *node, gpointer data )  	return XT_HANDLED;  } + +/* This one is needed to judge if we'll do authentication using IQ or SASL. +   It's done by checking if the <stream:stream> from the server has a +   version attribute. I don't know if this is the right way though... */ +gboolean sasl_supported( struct gaim_connection *gc ) +{ +	struct jabber_data *jd = gc->proto_data; +	 +	return ( jd->xt && jd->xt->root && xt_find_attr( jd->xt->root, "version" ) ) != NULL; +} | 
