diff options
| author | dequis <dx@dxzone.com.ar> | 2015-07-30 00:18:02 -0300 | 
|---|---|---|
| committer | dequis <dx@dxzone.com.ar> | 2015-07-30 00:18:02 -0300 | 
| commit | adec7492dd1ed55e12dfb959414a9a2c3605deed (patch) | |
| tree | 130390a01884df22df16b23b1d4f9dfef1019b50 /protocols/jabber/sasl.c | |
| parent | 4966712aa8cfa0d68b22028023d2be23364e6447 (diff) | |
| parent | 73dd021fa884bae857685e9a1beb44948c03399a (diff) | |
Merge branch 'develop'
Diffstat (limited to 'protocols/jabber/sasl.c')
| -rw-r--r-- | protocols/jabber/sasl.c | 16 | 
1 files changed, 14 insertions, 2 deletions
| diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c index 45d52593..beb53fdd 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,6 +144,15 @@ xt_status sasl_pkt_mechanisms(struct xt_node *node, gpointer data)  		imc_logout(ic, FALSE);  		xt_free_node(reply);  		return XT_ABORT; +	} 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) {  		xt_add_attr(reply, "mechanism", "DIGEST-MD5"); | 
