Changeset 9b02bab for protocols/jabber


Ignore:
Timestamp:
2015-12-05T01:52:48Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
ac68733a
Parents:
48b5fef
Message:

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

Location:
protocols/jabber
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    r48b5fef r9b02bab  
    151151        }
    152152
     153        if (strstr(jd->server, ".facebook.com")) {
     154                imcb_error(ic, "Facebook's XMPP service is gone. Try this instead: https://wiki.bitlbee.org/HowtoFacebookMQTT");
     155                imc_logout(ic, FALSE);
     156                return;
     157        }
     158
    153159        if ((s = strchr(jd->server, '/'))) {
    154160                *s = 0;
     
    170176                jd->fd = jd->r_inpa = jd->w_inpa = -1;
    171177
    172                 if (strstr(jd->server, ".facebook.com")) {
    173                         jd->oauth2_service = &oauth2_service_facebook;
    174                 } else {
    175                         jd->oauth2_service = &oauth2_service_google;
    176                 }
     178                /* There are no other options atm, so assume google for everything
     179                   Facebook and MSN XMPP used to be here. RIP. */
     180                jd->oauth2_service = &oauth2_service_google;
    177181
    178182                oauth_params_parse(&p_in, ic->acc->pass);
  • protocols/jabber/jabber.h

    r48b5fef r9b02bab  
    5050        JFLAG_GTALK =  0x100000,        /* Is Google Talk, as confirmed by iq discovery */
    5151        JFLAG_HIPCHAT = 0x200000,       /* Is hipchat, because prpl->name says so */
    52 
    53         JFLAG_SASL_FB = 0x10000,        /* Trying Facebook authentication. */
    5452} jabber_flags_t;
    5553
     
    342340
    343341extern const struct oauth2_service oauth2_service_google;
    344 extern const struct oauth2_service oauth2_service_facebook;
    345342
    346343/* conference.c */
  • protocols/jabber/sasl.c

    r48b5fef r9b02bab  
    3838        "6C-Zgf7Tr7gEQTPlBhMUgo7R",
    3939};
    40 const struct oauth2_service oauth2_service_facebook =
    41 {
    42         "https://www.facebook.com/dialog/oauth",
    43         "https://graph.facebook.com/oauth/access_token",
    44         "https://www.bitlbee.org/main.php/Facebook/oauth2.html",
    45         "offline_access,xmpp_login",
    46         "126828914005625",
    47         "4b100f0f244d620bf3f15f8b217d4c32",
    48 };
    4940
    5041xt_status sasl_pkt_mechanisms(struct xt_node *node, gpointer data)
     
    5445        struct xt_node *c, *reply;
    5546        char *s;
    56         int sup_plain = 0, sup_digest = 0, sup_gtalk = 0, sup_fb = 0, sup_anonymous = 0;
     47        int sup_plain = 0, sup_digest = 0, sup_gtalk = 0, sup_anonymous = 0;
    5748        int want_oauth = FALSE, want_hipchat = FALSE, want_anonymous = FALSE;
    5849        GString *mechs;
     
    8980                } else if (c->text && g_strcasecmp(c->text, "X-OAUTH2") == 0) {
    9081                        sup_gtalk = 1;
    91                 } else if (c->text && g_strcasecmp(c->text, "X-FACEBOOK-PLATFORM") == 0) {
    92                         sup_fb = 1;
    9382                }
    9483
     
    10190
    10291        if (!want_oauth && !sup_plain && !sup_digest) {
    103                 if (!sup_gtalk && !sup_fb) {
     92                if (!sup_gtalk) {
    10493                        imcb_error(ic, "This server requires OAuth "
    10594                                   "(supported schemes:%s)", mechs->str);
     
    137126                reply->text_len = strlen(reply->text);
    138127                g_free(s);
    139         } else if (sup_fb && want_oauth) {
    140                 xt_add_attr(reply, "mechanism", "X-FACEBOOK-PLATFORM");
    141                 jd->flags |= JFLAG_SASL_FB;
    142128        } else if (want_oauth) {
    143129                imcb_error(ic, "OAuth requested, but not supported by server");
     
    299285        dec = frombase64(node->text);
    300286
    301         if (jd->flags & JFLAG_SASL_FB) {
    302                 /* New-style Facebook OAauth2 support. Instead of sending a refresh
    303                    token, they just send an access token that should never expire. */
    304                 GSList *p_in = NULL, *p_out = NULL;
    305                 char time[33];
    306 
    307                 oauth_params_parse(&p_in, dec);
    308                 oauth_params_add(&p_out, "nonce", oauth_params_get(&p_in, "nonce"));
    309                 oauth_params_add(&p_out, "method", oauth_params_get(&p_in, "method"));
    310                 oauth_params_free(&p_in);
    311 
    312                 g_snprintf(time, sizeof(time), "%lld", (long long) (gettime() * 1000));
    313                 oauth_params_add(&p_out, "call_id", time);
    314                 oauth_params_add(&p_out, "api_key", oauth2_service_facebook.consumer_key);
    315                 oauth_params_add(&p_out, "v", "1.0");
    316                 oauth_params_add(&p_out, "format", "XML");
    317                 oauth_params_add(&p_out, "access_token", jd->oauth2_access_token);
    318 
    319                 reply = oauth_params_string(p_out);
    320                 oauth_params_free(&p_out);
    321         } else if (!(s = sasl_get_part(dec, "rspauth"))) {
     287        if (!(s = sasl_get_part(dec, "rspauth"))) {
    322288                /* See RFC 2831 for for information. */
    323289                md5_state_t A1, A2, H;
Note: See TracChangeset for help on using the changeset viewer.