Skip to content

Commit 24e967c

Browse files
committed
fix: trim incomming credentials
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 7974727 commit 24e967c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/connection.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,13 @@ async fn socket_auth(
263263
let username_msg = read_socket_auth_message(rx).await?;
264264
let username = username_msg
265265
.to_str()
266-
.map_err(|_| AuthenticationError::InvalidMessage)?;
266+
.map_err(|_| AuthenticationError::InvalidMessage)?
267+
.trim();
267268
let password_msg = read_socket_auth_message(rx).await?;
268269
let password = password_msg
269270
.to_str()
270-
.map_err(|_| AuthenticationError::InvalidMessage)?;
271+
.map_err(|_| AuthenticationError::InvalidMessage)?
272+
.trim();
271273

272274
// cleanup all pre_auth tokens older than 15s
273275
let cutoff = Instant::now() - Duration::from_secs(15);

0 commit comments

Comments
 (0)