Skip to content

Commit

Permalink
Merge branch 'main' into custom/aerogramme
Browse files Browse the repository at this point in the history
  • Loading branch information
superboum committed Jan 10, 2024
2 parents e37e370 + e99c7e1 commit 4c7891d
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 76 deletions.
5 changes: 3 additions & 2 deletions imap-codec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "imap-codec"
description = "Rock-solid and complete codec for IMAP"
keywords = ["email", "imap", "codec", "parser"]
categories = ["email", "parser-implementations", "encoding", "network-programming"]
version = "1.0.0"
version = "2.0.0"
authors = ["Damian Poddebniak <[email protected]>"]
repository = "https://github.com/duesee/imap-codec"
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -53,7 +53,8 @@ abnf-core = "0.6.0"
base64 = "0.21"
bounded-static = { version = "0.5.0", optional = true }
chrono = { version = "0.4", default-features = false, features = ["alloc"] }
imap-types = { version = "1.0.0", default-features = false, features = ["unvalidated"] }
# TODO: This should be `version = 2.0.0` but I can't make it work with `cargo-semver-checks`
imap-types = { path = "../imap-types", default-features = false, features = ["unvalidated"] }
nom = "7"
serde = { version = "1", features = ["derive"], optional = true }
thiserror = "1.0.29"
Expand Down
10 changes: 2 additions & 8 deletions imap-codec/src/codec/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,16 +656,10 @@ impl EncodeIntoContext for AuthenticateData {
Self::Continue(data) => {
let encoded = base64.encode(data.declassify());
ctx.write_all(encoded.as_bytes())?;
ctx.write_all(b"\r\n")?;
}
Self::Cancel => {
ctx.write_all(b"*\r\n")?;
ctx.write_all(b"\r\n")
}
Self::Cancel => ctx.write_all(b"*\r\n"),
}

ctx.push_authenticate_data();

Ok(())
}
}

Expand Down
3 changes: 1 addition & 2 deletions imap-codec/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,10 @@ mod tests {
}

#[test]
fn test__base64() {
fn test_base64() {
_base64.decode(b"AA==").unwrap();
// Note: "pad bits MUST be set to zero by conforming encoders" [RFC 4648, sec. 3.5].
//_base64.decode(b"aa==").unwrap();
_base64.decode(b"aQ==").unwrap();
//_base64.decode(b"aa==").unwrap();
}
}
1 change: 1 addition & 0 deletions imap-codec/tests/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,7 @@ Content-Type: TEXT/PLAIN; CHARSET=US-ASCII\r
StoreType::Add,
StoreResponse::Answer,
vec![Flag::Deleted],
vec![],
false,
)
.unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion imap-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "imap-types"
description = "Misuse-resistant data structures for IMAP"
keywords = ["email", "imap", "types"]
categories = ["email", "data-structures", "network-programming"]
version = "1.0.0"
version = "2.0.0"
authors = ["Damian Poddebniak <[email protected]>"]
repository = "https://github.com/duesee/imap-codec"
license = "MIT OR Apache-2.0"
Expand Down
3 changes: 3 additions & 0 deletions imap-types/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1889,6 +1889,7 @@ mod tests {
StoreType::Remove,
StoreResponse::Answer,
vec![Flag::Seen, Flag::Draft],
vec![],
false,
)
.unwrap(),
Expand All @@ -1897,6 +1898,7 @@ mod tests {
StoreType::Add,
StoreResponse::Answer,
vec![Flag::Keyword("TEST".try_into().unwrap())],
vec![],
true,
)
.unwrap(),
Expand Down Expand Up @@ -2034,6 +2036,7 @@ mod tests {
flags: vec![],
response: StoreResponse::Silent,
kind: StoreType::Add,
modifiers: vec![],
uid: true,
},
"STORE",
Expand Down
4 changes: 2 additions & 2 deletions imap-types/src/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ mod tests {
println!("-----");

let tests = [
AuthenticateData(Secret::new(b"xyz123".to_vec())),
AuthenticateData(Secret::from(b"xyz123".to_vec())),
AuthenticateData::Continue(Secret::new(b"xyz123".to_vec())),
AuthenticateData::Continue(Secret::from(b"xyz123".to_vec())),
];

for test in tests {
Expand Down
Loading

0 comments on commit 4c7891d

Please sign in to comment.