diff --git a/Cargo.toml b/Cargo.toml index ff8dea6..c9bc5c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ members = ["proto", "client", "cli"] [workspace.package] -version = "0.5.1" +version = "0.5.2" authors = ["William Brown "] rust-version = "1.74" edition = "2021" @@ -22,7 +22,6 @@ ldap3_client = { path = "./client", version = "0.5.0" } ldap3_proto = { path = "./proto", version = "0.5.0" } base64 = "0.21" -base64urlsafedata = "0.5.0" bytes = "^1.1.0" clap = "^3.2" clap_complete = "^3.2.3" @@ -38,6 +37,7 @@ rpassword = "7.0.0" serde = { version = "^1.0.136", features = ["derive"] } serde_json = "^1.0.79" serde_test = "^1.0.56" +serde_with = "3.9.0" thiserror = "1.0" tokio = "^1.17.0" tokio-util = "^0.7.1" diff --git a/client/Cargo.toml b/client/Cargo.toml index 19f2bac..627b48e 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -21,16 +21,16 @@ path = "src/lib.rs" [dependencies] base64.workspace = true -base64urlsafedata.workspace = true futures-util = { workspace = true, features = ["sink"] } ldap3_proto = { workspace = true, features = ["serde"] } -serde= { workspace = true, features = ["derive"] } +serde = { workspace = true, features = ["derive"] } +serde_with = { workspace = true, features = ["base64"] } openssl.workspace = true tokio = { workspace = true, features = ["net", "time", "sync", "io-util", "macros"] } tokio-util = { workspace = true, features = ["codec"] } tokio-openssl.workspace = true tracing.workspace = true url.workspace = true -uuid= {workspace = true, features = ["serde"] } +uuid = {workspace = true, features = ["serde"] } diff --git a/client/src/addirsync.rs b/client/src/addirsync.rs index 898c903..8dec196 100644 --- a/client/src/addirsync.rs +++ b/client/src/addirsync.rs @@ -1,6 +1,5 @@ use crate::LdapClient; use crate::*; -use base64urlsafedata::Base64UrlSafeData; use ldap3_proto::control::LdapControl; #[derive(Debug)] @@ -11,7 +10,7 @@ pub struct LdapSyncReplEntry { #[derive(Debug)] pub struct LdapSyncRepl { - pub cookie: Option, + pub cookie: Option>, pub entries: Vec, pub delete_uuids: Vec, pub present_uuids: Vec, @@ -69,7 +68,6 @@ impl LdapClient { cookie, }) = msg.ctrl.pop() { - let cookie = cookie.map(Base64UrlSafeData::from); break Ok(LdapSyncRepl { cookie, entries, diff --git a/client/src/syncrepl.rs b/client/src/syncrepl.rs index bf50e13..f890b1b 100644 --- a/client/src/syncrepl.rs +++ b/client/src/syncrepl.rs @@ -1,8 +1,8 @@ use crate::LdapClient; use crate::*; -use base64urlsafedata::Base64UrlSafeData; use ldap3_proto::control::LdapControl; use serde::{Deserialize, Serialize}; +use serde_with::{base64, formats, serde_as}; #[derive(Debug, Deserialize, Serialize, PartialEq)] pub enum LdapSyncStateValue { @@ -30,10 +30,12 @@ pub struct LdapSyncReplEntry { pub entry: LdapEntry, } +#[serde_as] #[derive(Debug, Deserialize, Serialize)] pub enum LdapSyncRepl { Success { - cookie: Option, + #[serde_as(as = "Option>")] + cookie: Option>, refresh_deletes: bool, entries: Vec, delete_uuids: Option>, @@ -96,7 +98,6 @@ impl LdapClient { refresh_deletes, }) = msg.ctrl.pop() { - let cookie = cookie.map(Base64UrlSafeData::from); break Ok(LdapSyncRepl::Success { cookie, refresh_deletes,