EHLO response fix.

This commit is contained in:
Mauro D 2023-01-19 08:25:46 +00:00
parent d48f0c75b7
commit 9b1a56a0de

View file

@ -25,8 +25,8 @@ impl<T: Display> EhloResponse<T> {
let mut capabilities = self.capabilities; let mut capabilities = self.capabilities;
while capabilities != 0 { while capabilities != 0 {
let capability = 31 - capabilities.leading_zeros(); let capability = 1 << (31 - capabilities.leading_zeros());
capabilities ^= 1 << capability; capabilities ^= capability;
writer.write_all(b"250")?; writer.write_all(b"250")?;
writer.write_all(if capabilities != 0 { b"-" } else { b" " })?; writer.write_all(if capabilities != 0 { b"-" } else { b" " })?;
@ -37,8 +37,8 @@ impl<T: Display> EhloResponse<T> {
writer.write_all(b"AUTH")?; writer.write_all(b"AUTH")?;
let mut mechanisms = self.auth_mechanisms; let mut mechanisms = self.auth_mechanisms;
while mechanisms != 0 { while mechanisms != 0 {
let item = 63 - mechanisms.leading_zeros(); let item = 1 << (63 - mechanisms.leading_zeros());
mechanisms ^= 1 << item; mechanisms ^= item;
write!(writer, " {}", (item as u64).to_mechanism())?; write!(writer, " {}", (item as u64).to_mechanism())?;
} }
writer.write_all(b"\r\n") writer.write_all(b"\r\n")