Changeset d6e2aa8


Ignore:
Timestamp:
2015-11-09T12:21:46Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
0d8a9bb0
Parents:
d63f37c
Message:

Nuke imcb_clean_handle(), which was merging handles accidentally

Well, just deprecated and turned into a no-op. It was only used for
jabber anonymous MUCs, but this is something the IRC layer must take
care of. It stripped all whitespace, control and non-ascii characters,
breaking utf8 nicks support and accidentally merging contacts whose
cleaned-up handles were the same string.

For example, you could have two users with nicks ' ' and ' ' (one and
two spaces respectively) and imcb_clean_handle() would just merge them
into a single handle, , which makes them look like a single irc user.
The same thing happens with nicks that are entirely made of utf8.

Thanks to schoppenhauer from #bitlbee for reporting this and preparing a
test case channel!

Location:
protocols
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/conference.c

    rd63f37c rd6e2aa8  
    302302                                        }
    303303                                }
    304 
    305                                 /* Some program-specific restrictions. */
    306                                 imcb_clean_handle(ic, bud->ext_jid);
    307304                        }
    308305                        bud->flags |= JBFLAG_IS_ANONYMOUS;
  • protocols/nogaim.c

    rd63f37c rd6e2aa8  
    735735}
    736736
     737/* Deprecated: using this function resulted in merging several handles accidentally
     738 * Also the irc layer handles this decently nowadays */
    737739void imcb_clean_handle(struct im_connection *ic, char *handle)
    738740{
    739         /* Accepts a handle and does whatever is necessary to make it
    740            BitlBee-friendly. Currently this means removing everything
    741            outside 33-127 (ASCII printable excl spaces), @ (only one
    742            is allowed) and ! and : */
    743         char out[strlen(handle) + 1];
    744         int s, d;
    745 
    746         s = d = 0;
    747         while (handle[s]) {
    748                 if (handle[s] > ' ' && handle[s] != '!' && handle[s] != ':' &&
    749                     (handle[s] & 0x80) == 0) {
    750                         if (handle[s] == '@') {
    751                                 /* See if we got an @ already? */
    752                                 out[d] = 0;
    753                                 if (strchr(out, '@')) {
    754                                         continue;
    755                                 }
    756                         }
    757 
    758                         out[d++] = handle[s];
    759                 }
    760                 s++;
    761         }
    762         out[d] = handle[s];
    763 
    764         strcpy(handle, out);
    765 }
     741}
  • protocols/nogaim.h

    rd63f37c rd6e2aa8  
    328328G_MODULE_EXPORT void imcb_buddy_typing(struct im_connection *ic, const char *handle, guint32 flags);
    329329G_MODULE_EXPORT struct bee_user *imcb_buddy_by_handle(struct im_connection *ic, const char *handle);
    330 G_MODULE_EXPORT void imcb_clean_handle(struct im_connection *ic, char *handle);
     330
     331G_GNUC_DEPRECATED G_MODULE_EXPORT void imcb_clean_handle(struct im_connection *ic, char *handle);
    331332
    332333/* Actions, or whatever. */
Note: See TracChangeset for help on using the changeset viewer.