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 @@ -765,7 +765,9 @@ static void _auth(xmpp_conn_t *conn)
765
765
conn -> ctx , "auth" ,
766
766
"Password hasn't been set, and SASL ANONYMOUS unsupported." );
767
767
xmpp_disconnect (conn );
768
- } else if (conn -> sasl_support & SASL_MASK_SCRAM ) {
768
+ } else if ((conn -> sasl_support & SASL_MASK_SCRAM_PLUS ) ||
769
+ ((conn -> sasl_support & SASL_MASK_SCRAM_WEAK ) &&
770
+ !conn -> only_strong_auth )) {
769
771
scram_ctx = strophe_alloc (conn -> ctx , sizeof (* scram_ctx ));
770
772
memset (scram_ctx , 0 , sizeof (* scram_ctx ));
771
773
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 {
233
233
mechanisms */
234
234
int auth_legacy_enabled ;
235
235
int weak_auth_enabled ;
236
+ int only_strong_auth ;
236
237
int secured ; /* set when stream is secured with TLS */
237
238
xmpp_certfail_handler certfail_handler ;
238
239
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)
1113
1113
XMPP_CONN_FLAG_TRUST_TLS * conn -> tls_trust |
1114
1114
XMPP_CONN_FLAG_DISABLE_SM * conn -> sm_disable |
1115
1115
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 ;
1117
1118
1118
1119
return flags ;
1119
1120
}
@@ -1163,6 +1164,7 @@ int xmpp_conn_set_flags(xmpp_conn_t *conn, long flags)
1163
1164
conn -> auth_legacy_enabled = (flags & XMPP_CONN_FLAG_LEGACY_AUTH ) ? 1 : 0 ;
1164
1165
conn -> sm_disable = (flags & XMPP_CONN_FLAG_DISABLE_SM ) ? 1 : 0 ;
1165
1166
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 ;
1166
1168
1167
1169
return 0 ;
1168
1170
}
Original file line number Diff line number Diff line change @@ -195,6 +195,10 @@ typedef struct _xmpp_sm_t xmpp_sm_state_t;
195
195
* Allow weak authentication methods (DIGEST-MD5 and PLAIN).
196
196
*/
197
197
#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)
198
202
199
203
/* connect callback */
200
204
typedef enum {
You can’t perform that action at this time.
0 commit comments