File tree Expand file tree Collapse file tree 4 files changed +12
-3
lines changed Expand file tree Collapse file tree 4 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -827,7 +827,8 @@ static void _auth(xmpp_conn_t *conn)
827
827
828
828
/* SASL algorithm was tried, unset flag */
829
829
conn -> sasl_support &= ~scram_ctx -> alg -> mask ;
830
- } else if (conn -> sasl_support & SASL_MASK_DIGESTMD5 ) {
830
+ } else if ((conn -> sasl_support & SASL_MASK_DIGESTMD5 ) &&
831
+ conn -> weak_auth_enabled ) {
831
832
auth = _make_sasl_auth (conn , "DIGEST-MD5" );
832
833
if (!auth ) {
833
834
disconnect_mem_error (conn );
@@ -841,7 +842,8 @@ static void _auth(xmpp_conn_t *conn)
841
842
842
843
/* SASL DIGEST-MD5 was tried, unset flag */
843
844
conn -> sasl_support &= ~SASL_MASK_DIGESTMD5 ;
844
- } else if (conn -> sasl_support & SASL_MASK_PLAIN ) {
845
+ } else if ((conn -> sasl_support & SASL_MASK_PLAIN ) &&
846
+ conn -> weak_auth_enabled ) {
845
847
auth = _make_sasl_auth (conn , "PLAIN" );
846
848
if (!auth ) {
847
849
disconnect_mem_error (conn );
Original file line number Diff line number Diff line change @@ -232,6 +232,7 @@ struct _xmpp_conn_t {
232
232
int sasl_support ; /* if true, field is a bitfield of supported
233
233
mechanisms */
234
234
int auth_legacy_enabled ;
235
+ int weak_auth_enabled ;
235
236
int secured ; /* set when stream is secured with TLS */
236
237
xmpp_certfail_handler certfail_handler ;
237
238
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_LEGACY_SSL * conn -> tls_legacy_ssl |
1113
1113
XMPP_CONN_FLAG_TRUST_TLS * conn -> tls_trust |
1114
1114
XMPP_CONN_FLAG_DISABLE_SM * conn -> sm_disable |
1115
- XMPP_CONN_FLAG_LEGACY_AUTH * conn -> auth_legacy_enabled ;
1115
+ XMPP_CONN_FLAG_LEGACY_AUTH * conn -> auth_legacy_enabled |
1116
+ XMPP_CONN_FLAG_WEAK_AUTH * conn -> weak_auth_enabled ;
1116
1117
1117
1118
return flags ;
1118
1119
}
@@ -1161,6 +1162,7 @@ int xmpp_conn_set_flags(xmpp_conn_t *conn, long flags)
1161
1162
conn -> tls_trust = (flags & XMPP_CONN_FLAG_TRUST_TLS ) ? 1 : 0 ;
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 ;
1165
+ conn -> weak_auth_enabled = (flags & XMPP_CONN_FLAG_WEAK_AUTH ) ? 1 : 0 ;
1164
1166
1165
1167
return 0 ;
1166
1168
}
Original file line number Diff line number Diff line change @@ -191,6 +191,10 @@ typedef struct _xmpp_sm_t xmpp_sm_state_t;
191
191
* Disable Stream-Management XEP-0198.
192
192
*/
193
193
#define XMPP_CONN_FLAG_DISABLE_SM (1UL << 5)
194
+ /** @def XMPP_CONN_FLAG_WEAK_AUTH
195
+ * Allow weak authentication methods (DIGEST-MD5 and PLAIN).
196
+ */
197
+ #define XMPP_CONN_FLAG_WEAK_AUTH (1UL << 6)
194
198
195
199
/* connect callback */
196
200
typedef enum {
You can’t perform that action at this time.
0 commit comments