File tree Expand file tree Collapse file tree 4 files changed +11
-2
lines changed Expand file tree Collapse file tree 4 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -776,7 +776,9 @@ static void _auth(xmpp_conn_t *conn)
776776 conn -> ctx , "auth" ,
777777 "Password hasn't been set, and SASL ANONYMOUS unsupported." );
778778 xmpp_disconnect (conn );
779- } else if (conn -> sasl_support & SASL_MASK_SCRAM ) {
779+ } else if ((conn -> sasl_support & SASL_MASK_SCRAM_PLUS ) ||
780+ ((conn -> sasl_support & SASL_MASK_SCRAM_WEAK ) &&
781+ !conn -> only_strong_auth )) {
780782 scram_ctx = strophe_alloc (conn -> ctx , sizeof (* scram_ctx ));
781783 memset (scram_ctx , 0 , sizeof (* scram_ctx ));
782784 if (conn -> sasl_support & SASL_MASK_SCRAMSHA256_PLUS ) {
Original file line number Diff line number Diff line change @@ -233,6 +233,7 @@ struct _xmpp_conn_t {
233233 mechanisms */
234234 int auth_legacy_enabled ;
235235 int weak_auth_enabled ;
236+ int only_strong_auth ;
236237 int secured ; /* set when stream is secured with TLS */
237238 xmpp_certfail_handler certfail_handler ;
238239 xmpp_password_callback password_callback ;
Original file line number Diff line number Diff line change @@ -1113,7 +1113,8 @@ long xmpp_conn_get_flags(const xmpp_conn_t *conn)
11131113 XMPP_CONN_FLAG_TRUST_TLS * conn -> tls_trust |
11141114 XMPP_CONN_FLAG_DISABLE_SM * conn -> sm_disable |
11151115 XMPP_CONN_FLAG_LEGACY_AUTH * conn -> auth_legacy_enabled |
1116- XMPP_CONN_FLAG_WEAK_AUTH * conn -> weak_auth_enabled ;
1116+ XMPP_CONN_FLAG_WEAK_AUTH * conn -> weak_auth_enabled |
1117+ XMPP_CONN_FLAG_STRONG_AUTH * conn -> only_strong_auth ;
11171118
11181119 return flags ;
11191120}
@@ -1163,6 +1164,7 @@ int xmpp_conn_set_flags(xmpp_conn_t *conn, long flags)
11631164 conn -> auth_legacy_enabled = (flags & XMPP_CONN_FLAG_LEGACY_AUTH ) ? 1 : 0 ;
11641165 conn -> sm_disable = (flags & XMPP_CONN_FLAG_DISABLE_SM ) ? 1 : 0 ;
11651166 conn -> weak_auth_enabled = (flags & XMPP_CONN_FLAG_WEAK_AUTH ) ? 1 : 0 ;
1167+ conn -> only_strong_auth = (flags & XMPP_CONN_FLAG_STRONG_AUTH ) ? 1 : 0 ;
11661168
11671169 return 0 ;
11681170}
Original file line number Diff line number Diff line change @@ -195,6 +195,10 @@ typedef struct _xmpp_sm_t xmpp_sm_state_t;
195195 * Allow weak authentication methods (DIGEST-MD5 and PLAIN).
196196 */
197197#define XMPP_CONN_FLAG_WEAK_AUTH (1UL << 6)
198+ /** @def XMPP_CONN_FLAG_STRONG_AUTH
199+ * Only allow strong authentication methods (Only the SCRAM-*-PLUS variants).
200+ */
201+ #define XMPP_CONN_FLAG_STRONG_AUTH (1UL << 7)
198202
199203/* connect callback */
200204typedef enum {
You can’t perform that action at this time.
0 commit comments