From 4eef27179a98cc1dd478ee9ccd05f30e36ce43bc Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 23 Jun 2010 01:13:46 +0100 Subject: Added user_agent setting to Jabber accounts so people can get around ridiculous user agent restrictions on certain Jabber servers. Obviously this is pretty simple to detect and break, but it works at least with Openfire. --- protocols/jabber/iq.c | 4 ++-- protocols/jabber/jabber.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'protocols/jabber') diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 95b21e1e..68777b0b 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -64,7 +64,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) /* Of course this is a very essential query to support. ;-) */ if( strcmp( s, XMLNS_VERSION ) == 0 ) { - xt_add_child( reply, xt_new_node( "name", "BitlBee", NULL ) ); + xt_add_child( reply, xt_new_node( "name", set_getstr( &ic->acc->set, "user_agent" ), NULL ) ); xt_add_child( reply, xt_new_node( "version", BITLBEE_VERSION, NULL ) ); xt_add_child( reply, xt_new_node( "os", ARCH, NULL ) ); } @@ -104,7 +104,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) c = xt_new_node( "identity", NULL, NULL ); xt_add_attr( c, "category", "client" ); xt_add_attr( c, "type", "pc" ); - xt_add_attr( c, "name", "BitlBee" ); + xt_add_attr( c, "name", set_getstr( &ic->acc->set, "user_agent" ) ); xt_add_child( reply, c ); for( f = features; *f; f ++ ) diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 8bb44691..48b8ac43 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -79,6 +79,8 @@ static void jabber_init( account_t *acc ) s = set_add( &acc->set, "tls", "try", set_eval_tls, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; + s = set_add( &acc->set, "user_agent", "BitlBee", NULL, acc ); + s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; -- cgit v1.2.3 From 90ba4161e5c24306233bc4627d1cde39a54006cf Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 23 Jun 2010 23:37:24 +0100 Subject: Fixed a NULL pointer dereference in the Jabber module. --- protocols/jabber/message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols/jabber') diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c index e8161029..fa915bd8 100644 --- a/protocols/jabber/message.c +++ b/protocols/jabber/message.c @@ -54,7 +54,7 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) char *ns = xt_find_attr( c, "xmlns" ), *room; struct xt_node *inv, *reason; - if( strcmp( ns, XMLNS_MUC_USER ) == 0 && + if( ns && strcmp( ns, XMLNS_MUC_USER ) == 0 && ( inv = xt_find_node( c->children, "invite" ) ) ) { room = from; -- cgit v1.2.3 From 38ff846b14f1d1f80983a0818b9bcf60581a2a34 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 24 Jun 2010 02:06:49 +0100 Subject: Fixed an access-after-free() bug in the Jabber keepalive + cache cleanup code. --- protocols/jabber/jabber.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'protocols/jabber') diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 48b8ac43..75351d0d 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -473,7 +473,8 @@ static void jabber_chat_invite_( struct groupchat *c, char *who, char *msg ) static void jabber_keepalive( struct im_connection *ic ) { /* Just any whitespace character is enough as a keepalive for XMPP sessions. */ - jabber_write( ic, "\n", 1 ); + if( !jabber_write( ic, "\n", 1 ) ) + return; /* This runs the garbage collection every minute, which means every packet is in the cache for about a minute (which should be enough AFAIK). */ -- cgit v1.2.3