aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-01-24 22:15:33 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-01-24 22:15:33 +0100
commit06d37d3399499c94fff408056155db76f43c4afa (patch)
treed5f3b8c2806dd77c0d3b3535331d771e99954589
parent337b7bce6d46b61dd6ba1203e180ee35c820c578 (diff)
downloadaerogramme-06d37d3399499c94fff408056155db76f43c4afa.tar.gz
aerogramme-06d37d3399499c94fff408056155db76f43c4afa.zip
correctly parse sasl
-rw-r--r--src/auth.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/auth.rs b/src/auth.rs
index 31b8206..4d2747f 100644
--- a/src/auth.rs
+++ b/src/auth.rs
@@ -683,9 +683,16 @@ fn server_command(buf: &u8) -> IResult<&u8, ServerCommand> {
//
// -----------------------------------------------------------------
+fn not_null(c: u8) -> bool {
+ c != 0x0
+}
+
// impersonated user, login, password
fn auth_plain<'a>(input: &'a [u8]) -> IResult<&'a [u8], (&'a [u8], &'a [u8], &'a [u8])> {
- tuple((is_not([0x0]), is_not([0x0]), rest))(input)
+ map(
+ tuple((take_while(not_null), take(1usize), take_while(not_null), take(1usize), rest)),
+ |(imp, _, user, _, pass)| (imp, user, pass),
+ )(input)
}
// -----------------------------------------------------------------