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 @@ -775,7 +775,9 @@ static void _auth(xmpp_conn_t *conn)
775775 conn -> ctx , "auth" ,
776776 "Password hasn't been set, and SASL ANONYMOUS unsupported." );
777777 xmpp_disconnect (conn );
778- } else if (conn -> sasl_support & SASL_MASK_SCRAM ) {
778+ } else if ((conn -> sasl_support & SASL_MASK_SCRAM_PLUS ) ||
779+ ((conn -> sasl_support & SASL_MASK_SCRAM_WEAK ) &&
780+ !conn -> only_strong_auth )) {
779781 size_t n ;
780782 scram_ctx = strophe_alloc (conn -> ctx , sizeof (* scram_ctx ));
781783 memset (scram_ctx , 0 , sizeof (* scram_ctx ));
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 @@ -1112,7 +1112,8 @@ long xmpp_conn_get_flags(const xmpp_conn_t *conn)
11121112 XMPP_CONN_FLAG_TRUST_TLS * conn -> tls_trust |
11131113 XMPP_CONN_FLAG_DISABLE_SM * conn -> sm_disable |
11141114 XMPP_CONN_FLAG_LEGACY_AUTH * conn -> auth_legacy_enabled |
1115- XMPP_CONN_FLAG_WEAK_AUTH * conn -> weak_auth_enabled ;
1115+ XMPP_CONN_FLAG_WEAK_AUTH * conn -> weak_auth_enabled |
1116+ XMPP_CONN_FLAG_STRONG_AUTH * conn -> only_strong_auth ;
11161117
11171118 return flags ;
11181119}
@@ -1162,6 +1163,7 @@ int xmpp_conn_set_flags(xmpp_conn_t *conn, long flags)
11621163 conn -> auth_legacy_enabled = (flags & XMPP_CONN_FLAG_LEGACY_AUTH ) ? 1 : 0 ;
11631164 conn -> sm_disable = (flags & XMPP_CONN_FLAG_DISABLE_SM ) ? 1 : 0 ;
11641165 conn -> weak_auth_enabled = (flags & XMPP_CONN_FLAG_WEAK_AUTH ) ? 1 : 0 ;
1166+ conn -> only_strong_auth = (flags & XMPP_CONN_FLAG_STRONG_AUTH ) ? 1 : 0 ;
11651167
11661168 return 0 ;
11671169}
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