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)
775
775
conn -> ctx , "auth" ,
776
776
"Password hasn't been set, and SASL ANONYMOUS unsupported." );
777
777
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 )) {
779
781
size_t n ;
780
782
scram_ctx = strophe_alloc (conn -> ctx , sizeof (* scram_ctx ));
781
783
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 {
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 @@ -1112,7 +1112,8 @@ long xmpp_conn_get_flags(const xmpp_conn_t *conn)
1112
1112
XMPP_CONN_FLAG_TRUST_TLS * conn -> tls_trust |
1113
1113
XMPP_CONN_FLAG_DISABLE_SM * conn -> sm_disable |
1114
1114
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 ;
1116
1117
1117
1118
return flags ;
1118
1119
}
@@ -1162,6 +1163,7 @@ int xmpp_conn_set_flags(xmpp_conn_t *conn, long flags)
1162
1163
conn -> auth_legacy_enabled = (flags & XMPP_CONN_FLAG_LEGACY_AUTH ) ? 1 : 0 ;
1163
1164
conn -> sm_disable = (flags & XMPP_CONN_FLAG_DISABLE_SM ) ? 1 : 0 ;
1164
1165
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 ;
1165
1167
1166
1168
return 0 ;
1167
1169
}
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