diff --git a/Cargo.lock b/Cargo.lock index 330f2eefa..333887fd0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5467,7 +5467,7 @@ checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" [[package]] name = "s3s" version = "0.11.0-dev" -source = "git+https://github.com/Nugine/s3s.git?rev=7c78bd75f818783f1263041b61ab08b8182519b4#7c78bd75f818783f1263041b61ab08b8182519b4" +source = "git+https://github.com/Nugine/s3s.git?rev=ab139f72fe768fb9d8cecfe36269451da1ca9779#ab139f72fe768fb9d8cecfe36269451da1ca9779" dependencies = [ "arrayvec", "async-trait", @@ -5514,7 +5514,7 @@ dependencies = [ [[package]] name = "s3s-policy" version = "0.11.0-dev" -source = "git+https://github.com/Nugine/s3s.git?rev=7c78bd75f818783f1263041b61ab08b8182519b4#7c78bd75f818783f1263041b61ab08b8182519b4" +source = "git+https://github.com/Nugine/s3s.git?rev=ab139f72fe768fb9d8cecfe36269451da1ca9779#ab139f72fe768fb9d8cecfe36269451da1ca9779" dependencies = [ "indexmap 2.7.1", "serde", diff --git a/Cargo.toml b/Cargo.toml index f9aaaf1d3..546232a15 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,10 +71,10 @@ reqwest = { version = "0.12.12", default-features = false, features = ["rustls-t rfd = { version = "0.15.2", default-features = false, features = ["xdg-portal", "tokio"] } rmp = "0.8.14" rmp-serde = "1.3.0" -s3s = { git = "https://github.com/Nugine/s3s.git", rev = "7c78bd75f818783f1263041b61ab08b8182519b4", default-features = true, features = [ +s3s = { git = "https://github.com/Nugine/s3s.git", rev = "ab139f72fe768fb9d8cecfe36269451da1ca9779", default-features = true, features = [ "tower", ] } -s3s-policy = { git = "https://github.com/Nugine/s3s.git", rev = "7c78bd75f818783f1263041b61ab08b8182519b4" } +s3s-policy = { git = "https://github.com/Nugine/s3s.git", rev = "ab139f72fe768fb9d8cecfe36269451da1ca9779" } shadow-rs = { version = "0.38.0", default-features = false } serde = { version = "1.0.217", features = ["derive"] } serde_json = "1.0.138" diff --git a/madmin/src/service_commands.rs b/madmin/src/service_commands.rs index 1b65a5a7a..30eabdb13 100644 --- a/madmin/src/service_commands.rs +++ b/madmin/src/service_commands.rs @@ -71,29 +71,29 @@ impl ServiceTraceOpts { }) .collect(); - self.s3 = query_pairs.get("s3").map_or(false, |v| v == "true"); - self.os = query_pairs.get("os").map_or(false, |v| v == "true"); - self.scanner = query_pairs.get("scanner").map_or(false, |v| v == "true"); - self.decommission = query_pairs.get("decommission").map_or(false, |v| v == "true"); - self.healing = query_pairs.get("healing").map_or(false, |v| v == "true"); - self.batch_replication = query_pairs.get("batch-replication").map_or(false, |v| v == "true"); - self.batch_key_rotation = query_pairs.get("batch-keyrotation").map_or(false, |v| v == "true"); - self.batch_expire = query_pairs.get("batch-expire").map_or(false, |v| v == "true"); - if query_pairs.get("all").map_or(false, |v| v == "true") { + self.s3 = query_pairs.get("s3").is_some_and(|v| v == "true"); + self.os = query_pairs.get("os").is_some_and(|v| v == "true"); + self.scanner = query_pairs.get("scanner").is_some_and(|v| v == "true"); + self.decommission = query_pairs.get("decommission").is_some_and(|v| v == "true"); + self.healing = query_pairs.get("healing").is_some_and(|v| v == "true"); + self.batch_replication = query_pairs.get("batch-replication").is_some_and(|v| v == "true"); + self.batch_key_rotation = query_pairs.get("batch-keyrotation").is_some_and(|v| v == "true"); + self.batch_expire = query_pairs.get("batch-expire").is_some_and(|v| v == "true"); + if query_pairs.get("all").is_some_and(|v| v == "true") { self.s3 = true; self.internal = true; self.storage = true; self.os = true; } - self.rebalance = query_pairs.get("rebalance").map_or(false, |v| v == "true"); - self.storage = query_pairs.get("storage").map_or(false, |v| v == "true"); - self.internal = query_pairs.get("internal").map_or(false, |v| v == "true"); - self.only_errors = query_pairs.get("err").map_or(false, |v| v == "true"); - self.replication_resync = query_pairs.get("replication-resync").map_or(false, |v| v == "true"); - self.bootstrap = query_pairs.get("bootstrap").map_or(false, |v| v == "true"); - self.ftp = query_pairs.get("ftp").map_or(false, |v| v == "true"); - self.ilm = query_pairs.get("ilm").map_or(false, |v| v == "true"); + self.rebalance = query_pairs.get("rebalance").is_some_and(|v| v == "true"); + self.storage = query_pairs.get("storage").is_some_and(|v| v == "true"); + self.internal = query_pairs.get("internal").is_some_and(|v| v == "true"); + self.only_errors = query_pairs.get("err").is_some_and(|v| v == "true"); + self.replication_resync = query_pairs.get("replication-resync").is_some_and(|v| v == "true"); + self.bootstrap = query_pairs.get("bootstrap").is_some_and(|v| v == "true"); + self.ftp = query_pairs.get("ftp").is_some_and(|v| v == "true"); + self.ilm = query_pairs.get("ilm").is_some_and(|v| v == "true"); if let Some(threshold) = query_pairs.get("threshold") { let duration = parse_duration(threshold)?; diff --git a/rustfs/src/auth.rs b/rustfs/src/auth.rs index 1f673a096..8106ff801 100644 --- a/rustfs/src/auth.rs +++ b/rustfs/src/auth.rs @@ -19,7 +19,7 @@ impl IAMAuth { impl S3Auth for IAMAuth { async fn get_secret_key(&self, access_key: &str) -> S3Result { if access_key.is_empty() { - return Err(s3_error!(NotSignedUp, "Your account is not signed up")); + return Err(s3_error!(UnauthorizedAccess, "Your account is not signed up")); } if let Ok(key) = self.simple_auth.get_secret_key(access_key).await { @@ -32,6 +32,6 @@ impl S3Auth for IAMAuth { } } - Err(s3_error!(NotSignedUp, "Your account is not signed up2")) + Err(s3_error!(UnauthorizedAccess, "Your account is not signed up2")) } } diff --git a/rustfs/src/grpc.rs b/rustfs/src/grpc.rs index 9b2e88f75..0411d0957 100644 --- a/rustfs/src/grpc.rs +++ b/rustfs/src/grpc.rs @@ -67,10 +67,7 @@ fn match_for_io_error(err_status: &Status) -> Option<&std::io::Error> { } } - err = match err.source() { - Some(err) => err, - None => return None, - }; + err = err.source()?; } } diff --git a/rustfs/src/storage/access.rs b/rustfs/src/storage/access.rs index 1581e96e0..2ff57c9af 100644 --- a/rustfs/src/storage/access.rs +++ b/rustfs/src/storage/access.rs @@ -52,7 +52,7 @@ impl S3Access for FS { ); if cx.credentials().is_none() { - return Err(s3_error!(AccessDenied, "Signature is required")); + return Err(s3_error!(UnauthorizedAccess, "Signature is required")); }; // TODO: FIXME: check auth diff --git a/rustfs/src/storage/ecfs.rs b/rustfs/src/storage/ecfs.rs index ee699d98e..1542b1f16 100644 --- a/rustfs/src/storage/ecfs.rs +++ b/rustfs/src/storage/ecfs.rs @@ -550,6 +550,7 @@ impl S3 for FS { .map(|v| Bucket { creation_date: v.created.map(Timestamp::from), name: Some(v.name.clone()), + ..Default::default() }) .collect();