diff options
| author | dequis <dx@dxzone.com.ar> | 2015-12-04 22:52:48 -0300 | 
|---|---|---|
| committer | dequis <dx@dxzone.com.ar> | 2015-12-04 22:52:48 -0300 | 
| commit | 9b02bab9832308cf88d86a379b3afd2f142816e2 (patch) | |
| tree | 99ad03455e1c15c0b3804d04c50e6d693eeb88f7 /protocols | |
| parent | 48b5fef4553ff38711bbdf1773b13841cf0f13c3 (diff) | |
Remove facebook XMPP code, show error pointing at the new plugin
Facebook's oauth has been broken for months, and in the last few days
they broke plain logins too, so I just added an error message that says
this when you do "account on":
    Facebook's XMPP service is gone. Try this instead:
    https://wiki.bitlbee.org/HowtoFacebookMQTT
Also nuked all the oauth related code, except some parts of lib/oauth2.c
which seemed generic enough to maybe help in the future with other
not-really-compliant not-really-implementations of the not-really-oauth2
not-really-spec
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/account.c | 2 | ||||
| -rw-r--r-- | protocols/jabber/jabber.c | 14 | ||||
| -rw-r--r-- | protocols/jabber/jabber.h | 3 | ||||
| -rw-r--r-- | protocols/jabber/sasl.c | 40 | 
4 files changed, 12 insertions, 47 deletions
| diff --git a/protocols/account.c b/protocols/account.c index e1025a53..fcafe215 100644 --- a/protocols/account.c +++ b/protocols/account.c @@ -87,8 +87,6 @@ account_t *account_add(bee_t *bee, struct prpl *prpl, char *user, char *pass)  		if (strstr(a->user, "@gmail.com") ||  		    strstr(a->user, "@googlemail.com")) {  			strcpy(tag, "gtalk"); -		} else if (strstr(a->user, "@chat.facebook.com")) { -			strcpy(tag, "fb");  		}  	} diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index ddf4f2d3..0da65c84 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -150,6 +150,12 @@ static void jabber_login(account_t *acc)  		return;  	} +	if (strstr(jd->server, ".facebook.com")) { +		imcb_error(ic, "Facebook's XMPP service is gone. Try this instead: https://wiki.bitlbee.org/HowtoFacebookMQTT"); +		imc_logout(ic, FALSE); +		return; +	} +  	if ((s = strchr(jd->server, '/'))) {  		*s = 0;  		set_setstr(&acc->set, "resource", s + 1); @@ -169,11 +175,9 @@ static void jabber_login(account_t *acc)  		jd->fd = jd->r_inpa = jd->w_inpa = -1; -		if (strstr(jd->server, ".facebook.com")) { -			jd->oauth2_service = &oauth2_service_facebook; -		} else { -			jd->oauth2_service = &oauth2_service_google; -		} +		/* There are no other options atm, so assume google for everything  +		   Facebook and MSN XMPP used to be here. RIP. */ +		jd->oauth2_service = &oauth2_service_google;  		oauth_params_parse(&p_in, ic->acc->pass); diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index b50e0cb5..8796b8fc 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -49,8 +49,6 @@ typedef enum {  	JFLAG_GTALK =  0x100000,        /* Is Google Talk, as confirmed by iq discovery */  	JFLAG_HIPCHAT = 0x200000,       /* Is hipchat, because prpl->name says so */ - -	JFLAG_SASL_FB = 0x10000,        /* Trying Facebook authentication. */  } jabber_flags_t;  typedef enum { @@ -341,7 +339,6 @@ int sasl_oauth2_get_refresh_token(struct im_connection *ic, const char *msg);  int sasl_oauth2_refresh(struct im_connection *ic, const char *refresh_token);  extern const struct oauth2_service oauth2_service_google; -extern const struct oauth2_service oauth2_service_facebook;  /* conference.c */  struct groupchat *jabber_chat_join(struct im_connection *ic, const char *room, const char *nick, const char *password); diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c index 86f428c9..aa43def0 100644 --- a/protocols/jabber/sasl.c +++ b/protocols/jabber/sasl.c @@ -37,15 +37,6 @@ const struct oauth2_service oauth2_service_google =  	"783993391592.apps.googleusercontent.com",  	"6C-Zgf7Tr7gEQTPlBhMUgo7R",  }; -const struct oauth2_service oauth2_service_facebook = -{ -	"https://www.facebook.com/dialog/oauth", -	"https://graph.facebook.com/oauth/access_token", -	"https://www.bitlbee.org/main.php/Facebook/oauth2.html", -	"offline_access,xmpp_login", -	"126828914005625", -	"4b100f0f244d620bf3f15f8b217d4c32", -};  xt_status sasl_pkt_mechanisms(struct xt_node *node, gpointer data)  { @@ -53,7 +44,7 @@ xt_status sasl_pkt_mechanisms(struct xt_node *node, gpointer data)  	struct jabber_data *jd = ic->proto_data;  	struct xt_node *c, *reply;  	char *s; -	int sup_plain = 0, sup_digest = 0, sup_gtalk = 0, sup_fb = 0, sup_anonymous = 0; +	int sup_plain = 0, sup_digest = 0, sup_gtalk = 0, sup_anonymous = 0;  	int want_oauth = FALSE, want_hipchat = FALSE, want_anonymous = FALSE;  	GString *mechs; @@ -88,8 +79,6 @@ xt_status sasl_pkt_mechanisms(struct xt_node *node, gpointer data)  			sup_anonymous = 1;  		} else if (c->text && g_strcasecmp(c->text, "X-OAUTH2") == 0) {  			sup_gtalk = 1; -		} else if (c->text && g_strcasecmp(c->text, "X-FACEBOOK-PLATFORM") == 0) { -			sup_fb = 1;  		}  		if (c->text) { @@ -100,7 +89,7 @@ xt_status sasl_pkt_mechanisms(struct xt_node *node, gpointer data)  	}  	if (!want_oauth && !sup_plain && !sup_digest) { -		if (!sup_gtalk && !sup_fb) { +		if (!sup_gtalk) {  			imcb_error(ic, "This server requires OAuth "  			           "(supported schemes:%s)", mechs->str);  		} else { @@ -136,9 +125,6 @@ xt_status sasl_pkt_mechanisms(struct xt_node *node, gpointer data)  		reply->text = base64_encode((unsigned char *) s, len);  		reply->text_len = strlen(reply->text);  		g_free(s); -	} else if (sup_fb && want_oauth) { -		xt_add_attr(reply, "mechanism", "X-FACEBOOK-PLATFORM"); -		jd->flags |= JFLAG_SASL_FB;  	} else if (want_oauth) {  		imcb_error(ic, "OAuth requested, but not supported by server");  		imc_logout(ic, FALSE); @@ -298,27 +284,7 @@ xt_status sasl_pkt_challenge(struct xt_node *node, gpointer data)  	dec = frombase64(node->text); -	if (jd->flags & JFLAG_SASL_FB) { -		/* New-style Facebook OAauth2 support. Instead of sending a refresh -		   token, they just send an access token that should never expire. */ -		GSList *p_in = NULL, *p_out = NULL; -		char time[33]; - -		oauth_params_parse(&p_in, dec); -		oauth_params_add(&p_out, "nonce", oauth_params_get(&p_in, "nonce")); -		oauth_params_add(&p_out, "method", oauth_params_get(&p_in, "method")); -		oauth_params_free(&p_in); - -		g_snprintf(time, sizeof(time), "%lld", (long long) (gettime() * 1000)); -		oauth_params_add(&p_out, "call_id", time); -		oauth_params_add(&p_out, "api_key", oauth2_service_facebook.consumer_key); -		oauth_params_add(&p_out, "v", "1.0"); -		oauth_params_add(&p_out, "format", "XML"); -		oauth_params_add(&p_out, "access_token", jd->oauth2_access_token); - -		reply = oauth_params_string(p_out); -		oauth_params_free(&p_out); -	} else if (!(s = sasl_get_part(dec, "rspauth"))) { +	if (!(s = sasl_get_part(dec, "rspauth"))) {  		/* See RFC 2831 for for information. */  		md5_state_t A1, A2, H;  		md5_byte_t A1r[16], A2r[16], Hr[16]; | 
