diff options
-rwxr-xr-x | configure | 52 | ||||
-rw-r--r-- | doc/user-guide/commands.xml | 15 | ||||
-rw-r--r-- | irc_channel.c | 8 | ||||
-rw-r--r-- | irc_im.c | 3 | ||||
-rw-r--r-- | lib/json.c | 2 | ||||
-rw-r--r-- | protocols/jabber/jabber.c | 5 | ||||
-rw-r--r-- | protocols/jabber/s5bytestream.c | 2 | ||||
-rw-r--r-- | protocols/jabber/sasl.c | 22 |
8 files changed, 72 insertions, 37 deletions
@@ -50,8 +50,8 @@ ssl=auto pie=1 -arch=`uname -s` -cpu=`uname -m` +arch=$(uname -s) +cpu=$(uname -m) GLIB_MIN_VERSION=2.16 @@ -102,7 +102,7 @@ fi echo BitlBee configure while [ -n "$1" ]; do - e="`expr "X$1" : 'X--\(.*=.*\)'`" + e="$(expr "X$1" : 'X--\(.*=.*\)')" if [ -z "$e" ]; then cat<<EOF @@ -156,19 +156,19 @@ EOF done # Expand $prefix and get rid of double slashes -bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'` -sbindir=`eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g'` -etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'` -mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'` -datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'` -config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` -plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'` -includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'` -libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'` - -pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'` -ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'` -pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'` +bindir=$(eval echo "$bindir/" | sed 's/\/\{1,\}/\//g') +sbindir=$(eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g') +etcdir=$(eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g') +mandir=$(eval echo "$mandir/" | sed 's/\/\{1,\}/\//g') +datadir=$(eval echo "$datadir/" | sed 's/\/\{1,\}/\//g') +config=$(eval echo "$config/" | sed 's/\/\{1,\}/\//g') +plugindir=$(eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g') +includedir=$(eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g') +libevent=$(eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g') + +pidfile=$(eval echo "$pidfile" | sed 's/\/\{1,\}/\//g') +ipcsocket=$(eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g') +pcdir=$(eval echo "$pcdir" | sed 's/\/\{1,\}/\//g') protocols_mods="" @@ -307,12 +307,12 @@ fi if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then cat<<EOF >>Makefile.settings -EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0` -CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0` +EFLAGS+=$($PKG_CONFIG --libs glib-2.0 gmodule-2.0) +CFLAGS+=$($PKG_CONFIG --cflags glib-2.0 gmodule-2.0) EOF else echo - echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.' + echo 'Found glib2 '$($PKG_CONFIG glib-2.0 --modversion)', but version '$GLIB_MIN_VERSION' or newer is required.' exit 1 fi else @@ -348,8 +348,8 @@ detect_gnutls() { if $PKG_CONFIG --exists gnutls; then cat <<EOF >>Makefile.settings -EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs` -CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags` +EFLAGS+=$($PKG_CONFIG --libs gnutls) $(libgcrypt-config --libs) +CFLAGS+=$($PKG_CONFIG --cflags gnutls) $(libgcrypt-config --cflags) EOF ssl=gnutls if ! pkg-config gnutls --atleast-version=2.8; then @@ -359,8 +359,8 @@ EOF ret=1 elif libgnutls-config --version > /dev/null 2> /dev/null; then cat <<EOF >>Makefile.settings -EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs` -CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags` +EFLAGS+=$(libgnutls-config --libs) $(libgcrypt-config --libs) +CFLAGS+=$(libgnutls-config --cflags) $(libgcrypt-config --cflags) EOF ssl=gnutls @@ -374,8 +374,8 @@ detect_nss() { if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then cat<<EOF >>Makefile.settings -EFLAGS+=`$PKG_CONFIG --libs nss` -CFLAGS+=`$PKG_CONFIG --cflags nss` +EFLAGS+=$($PKG_CONFIG --libs nss) +CFLAGS+=$($PKG_CONFIG --cflags nss) EOF ssl=nss @@ -620,7 +620,7 @@ fi if [ -z "$systemdsystemunitdir" ]; then if $PKG_CONFIG --exists systemd; then - systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` + systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) fi fi if [ -n "$systemdsystemunitdir" ]; then diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index 0de4dfcf..8c246d5e 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -1185,6 +1185,21 @@ </bitlbee-setting> + <bitlbee-setting name="anonymous" type="boolean" scope="account"> + <default>false</default> + + <description> + <para> + This enables SASL ANONYMOUS login for jabber accounts, as specified by XEP-0175. + </para> + + <para> + With this setting enabled, if the server allows this method, a password isn't required and the username part of the JID is ignored (you can use anonymous@jabber.example.com). Servers will usually assign you a random numeric username instead. + </para> + </description> + + </bitlbee-setting> + <bitlbee-setting name="ops" type="string" scope="global"> <default>both</default> <possible-values>both, root, user, none</possible-values> diff --git a/irc_channel.c b/irc_channel.c index acae85a7..3de68e34 100644 --- a/irc_channel.c +++ b/irc_channel.c @@ -444,10 +444,10 @@ void irc_channel_auto_joins(irc_t *irc, account_t *acc) can only auto-join them if their account is online. */ char *acc_s; - if (!aj || (ic->flags & IRC_CHANNEL_JOINED)) { - /* Only continue if this one's marked as auto_join - or if we're in it already. (Possible if the - client auto-rejoined it before identyfing.) */ + if (!aj && !(ic->flags & IRC_CHANNEL_JOINED)) { + /* Only proceed if this one's marked as auto_join + or if we're in it already. (Very likely the IRC + client auto-(re)joining at reconnect time.) */ continue; } else if (!(acc_s = set_getstr(&ic->set, "account"))) { continue; @@ -835,7 +835,8 @@ static gboolean bee_irc_channel_chat_join(irc_channel_t *ic) if ((acc_s = set_getstr(&ic->set, "account")) && (room = set_getstr(&ic->set, "room")) && (acc = account_get(ic->irc->b, acc_s)) && - acc->ic && acc->prpl->chat_join) { + acc->ic && (acc->ic->flags & OPT_LOGGED_IN) && + acc->prpl->chat_join) { char *nick; if (!(nick = set_getstr(&ic->set, "nick"))) { @@ -508,7 +508,7 @@ whitespace: case ']': - if (top->type == json_array) { + if (top && top->type == json_array) { flags = (flags & ~(flag_need_comma | flag_seek_value)) | flag_next; } else { sprintf(error, "%d:%d: Unexpected ]", cur_line, e_off); goto e_failed; } diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 431b3e54..38fb4966 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -84,7 +84,10 @@ static void jabber_init(account_t *acc) if (strcmp(acc->prpl->name, "hipchat") == 0) { set_setstr(&acc->set, "server", "chat.hipchat.com"); } else { - s = set_add(&acc->set, "oauth", "false", set_eval_oauth, acc); + set_add(&acc->set, "oauth", "false", set_eval_oauth, acc); + + /* this reuses set_eval_oauth, which clears the password */ + set_add(&acc->set, "anonymous", "false", set_eval_oauth, acc); } s = set_add(&acc->set, "ssl", "false", set_eval_bool, acc); diff --git a/protocols/jabber/s5bytestream.c b/protocols/jabber/s5bytestream.c index 60d522e4..f9f9d2e1 100644 --- a/protocols/jabber/s5bytestream.c +++ b/protocols/jabber/s5bytestream.c @@ -84,7 +84,7 @@ char *socks5_reply_code[] = { if ((op) == -1) { \ return jabber_bs_abort(bt, msg ": %s", strerror(errno)); } -gboolean jabber_bs_abort(struct bs_transfer *bt, char *format, ...); +gboolean jabber_bs_abort(struct bs_transfer *bt, char *format, ...) G_GNUC_PRINTF(2, 3); void jabber_bs_canceled(file_transfer_t *ft, char *reason); void jabber_bs_free_transfer(file_transfer_t *ft); gboolean jabber_bs_connect_timeout(gpointer data, gint fd, b_input_condition cond); diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c index 45d52593..86f428c9 100644 --- a/protocols/jabber/sasl.c +++ b/protocols/jabber/sasl.c @@ -53,8 +53,8 @@ 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; - int want_oauth = FALSE, want_hipchat = FALSE; + int sup_plain = 0, sup_digest = 0, sup_gtalk = 0, sup_fb = 0, sup_anonymous = 0; + int want_oauth = FALSE, want_hipchat = FALSE, want_anonymous = FALSE; GString *mechs; if (!sasl_supported(ic)) { @@ -73,6 +73,7 @@ xt_status sasl_pkt_mechanisms(struct xt_node *node, gpointer data) return XT_ABORT; } + want_anonymous = set_getbool(&ic->acc->set, "anonymous"); want_oauth = set_getbool(&ic->acc->set, "oauth"); want_hipchat = (jd->flags & JFLAG_HIPCHAT); @@ -83,6 +84,8 @@ xt_status sasl_pkt_mechanisms(struct xt_node *node, gpointer data) sup_plain = 1; } else if (c->text && g_strcasecmp(c->text, "DIGEST-MD5") == 0) { sup_digest = 1; + } else if (c->text && g_strcasecmp(c->text, "ANONYMOUS") == 0) { + 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) { @@ -141,7 +144,20 @@ xt_status sasl_pkt_mechanisms(struct xt_node *node, gpointer data) imc_logout(ic, FALSE); xt_free_node(reply); return XT_ABORT; - } else if (sup_digest) { + } else if (want_anonymous && sup_anonymous) { + xt_add_attr(reply, "mechanism", "ANONYMOUS"); + + /* Well, that was easy. */ + } else if (want_anonymous) { + imcb_error(ic, "Anonymous login requested, but not supported by server"); + imc_logout(ic, FALSE); + xt_free_node(reply); + return XT_ABORT; + } else if (sup_digest && !(jd->ssl && sup_plain)) { + /* Only try DIGEST-MD5 if there's no SSL/TLS or if PLAIN isn't supported. + * Which in practice means "don't bother with DIGEST-MD5 most of the time". + * It's weak, pointless over TLS, and often breaks with some servers (hi openfire) */ + xt_add_attr(reply, "mechanism", "DIGEST-MD5"); /* The rest will be done later, when we receive a <challenge/>. */ |