@@ -1266,17 +1266,26 @@ send_features(#{stream_version := {1,0},
1266
1266
TLSAvailable = is_starttls_available (State ),
1267
1267
TLSRequired = is_starttls_required (State ),
1268
1268
Sasl2 = maps :is_key (sasl2_stream_from , State ),
1269
+ AllowUnencryptedSasl2 = allow_unencrypted_sasl2 (State ),
1269
1270
if
1270
1271
(not Encrypted ) andalso TLSRequired ->
1271
1272
send_pkt (State , # stream_features {sub_els = get_tls_feature (State )});
1272
1273
true ->
1273
1274
{Features , State2 } =
1274
- case {Encrypted , Sasl2 , TLSAvailable } of
1275
- {true , true , _ } -> {get_sasl2_feature (State ), init_channel_bindings (State )};
1276
- {false , true , false } -> {[], disable_sasl2 (State )};
1277
- {false , _ , true } -> {get_tls_feature (State ), State };
1278
- {true , _ , _ } -> {[], init_channel_bindings (State )};
1279
- _ -> {[], State }
1275
+ case {Encrypted , Sasl2 , AllowUnencryptedSasl2 , TLSAvailable } of
1276
+ {false , true , true , true } ->
1277
+ {get_tls_feature (State ) ++ get_sasl2_feature (State ),
1278
+ init_channel_bindings (State )};
1279
+ {_ , true , _ , _ } when Encrypted ; AllowUnencryptedSasl2 ->
1280
+ {get_sasl2_feature (State ), init_channel_bindings (State )};
1281
+ {false , true , false , false } ->
1282
+ {[], disable_sasl2 (State )};
1283
+ {false , _ , _ , true } ->
1284
+ {get_tls_feature (State ), State };
1285
+ {true , _ , _ , _ } ->
1286
+ {[], init_channel_bindings (State )};
1287
+ _ ->
1288
+ {[], State }
1280
1289
end ,
1281
1290
Features2 =
1282
1291
get_sasl_feature (State2 ) ++
0 commit comments