Skip to content

Commit c9469ea

Browse files
committed
Simplify logic
1 parent 8079ed6 commit c9469ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tokio-postgres/src/connect_raw.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,10 @@ where
256256
match channel_binding {
257257
Some(channel_binding) => (channel_binding, sasl::SCRAM_SHA_256_PLUS),
258258
None => {
259-
can_skip_channel_binding(config)?;
260-
261259
(sasl::ChannelBinding::unsupported(), sasl::SCRAM_SHA_256)
262260
},
263261
}
264262
} else if has_scram {
265-
can_skip_channel_binding(config)?;
266-
267263
match channel_binding {
268264
Some(_) => (sasl::ChannelBinding::unrequested(), sasl::SCRAM_SHA_256),
269265
None => (sasl::ChannelBinding::unsupported(), sasl::SCRAM_SHA_256),
@@ -272,6 +268,10 @@ where
272268
return Err(Error::authentication("unsupported SASL mechanism".into()));
273269
};
274270

271+
if mechanism != sasl::SCRAM_SHA_256_PLUS {
272+
can_skip_channel_binding(config)?;
273+
}
274+
275275
let mut scram = ScramSha256::new(password, channel_binding);
276276

277277
let mut buf = vec![];

0 commit comments

Comments
 (0)