Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resolver = "2"
version = "0.0.0-dev"
authors = ["Stackable GmbH <info@stackable.tech>"]
license = "OSL-3.0"
edition = "2021"
edition = "2024"
repository = "https://github.com/stackabletech/secret-operator"

[workspace.dependencies]
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/crd/secret_class/v1alpha1_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl SecretClassBackend {
pub fn refers_to_config_map(
&self,
config_map: &PartialObjectMeta<ConfigMap>,
) -> impl Iterator<Item = SearchNamespaceMatchCondition> {
) -> impl Iterator<Item = SearchNamespaceMatchCondition> + use<> {
let cm_namespace = config_map.metadata.namespace.as_deref();
match self {
Self::K8sSearch(backend) => {
Expand All @@ -40,7 +40,7 @@ impl SecretClassBackend {
pub fn refers_to_secret(
&self,
secret: &PartialObjectMeta<Secret>,
) -> impl Iterator<Item = SearchNamespaceMatchCondition> {
) -> impl Iterator<Item = SearchNamespaceMatchCondition> + use<> {
match self {
Self::AutoTls(backend) => {
(backend.ca.secret == *secret).then_some(SearchNamespaceMatchCondition::True)
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/crd/secret_class/v1alpha2_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl SecretClassBackend {
pub fn refers_to_config_map(
&self,
config_map: &PartialObjectMeta<ConfigMap>,
) -> impl Iterator<Item = SearchNamespaceMatchCondition> {
) -> impl Iterator<Item = SearchNamespaceMatchCondition> + use<> {
let cm_namespace = config_map.metadata.namespace.as_deref();
match self {
Self::K8sSearch(backend) => {
Expand All @@ -46,7 +46,7 @@ impl SecretClassBackend {
pub fn refers_to_secret(
&self,
secret: &PartialObjectMeta<Secret>,
) -> impl Iterator<Item = SearchNamespaceMatchCondition> {
) -> impl Iterator<Item = SearchNamespaceMatchCondition> + use<> {
match self {
Self::AutoTls(backend) => {
(backend.ca.secret == *secret).then_some(SearchNamespaceMatchCondition::True)
Expand Down
13 changes: 9 additions & 4 deletions rust/operator-binary/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,19 @@ pub fn error_full_message(err: &dyn std::error::Error) -> String {
/// Propagates `Ok(true)` and `Err(_)` from `stream`, otherwise returns `Ok(false)`.
pub async fn trystream_any<S: Stream<Item = Result<bool, E>>, E>(stream: S) -> Result<bool, E> {
pin_mut!(stream);
while let Some(value) = stream.next().await {
if let Ok(true) | Err(_) = value {
return value;
loop {
Comment thread
sbernauer marked this conversation as resolved.
Outdated
let next_item = stream.next().await;
match next_item {
Some(value) => {
if let Ok(true) | Err(_) = value {
return value;
}
}
None => break,
}
}
Ok(false)
}

/// Concatenate chunks of bytes, short-circuiting on [`Err`].
///
/// This is a byte-oriented equivalent to [`Iterator::collect::<Result<String, _>>`](`Iterator::collect`).
Expand Down
4 changes: 2 additions & 2 deletions rust/p12/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
name = "p12"
version.workspace = true
authors = ["hjiayz <hjiayz@gmail.com>", "Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
edition = "2021"
edition.workspace = true
keywords = ["pkcs12", "pkcs"]
description = "pure rust pkcs12 tool (Stackable fork)"
homepage = "https://github.com/hjiayz/p12"
repository = "https://github.com/hjiayz/p12"
readme = "README.md"
license = "MIT OR Apache-2.0"
rust-version = "1.56.0"
rust-version = "1.85.0"

# Dependencies are tracked inline for now, to minimize divergence from upstream

Expand Down
4 changes: 2 additions & 2 deletions rust/p12/src/lib.rs
Comment thread
sbernauer marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,12 @@ fn pbepkcs12sha1(pass: &[u8], salt: &[u8], iterations: u64, id: u8, size: u64) -
let d = [id; V as usize];
fn get_len(s: usize) -> usize {
let s = s as u64;
(V * ((s + V - 1) / V)) as usize
(V * s.div_ceil(V)) as usize
Comment thread
sbernauer marked this conversation as resolved.
Outdated
}
let s = salt.iter().cycle().take(get_len(salt.len()));
let p = pass.iter().cycle().take(get_len(pass.len()));
let mut i: Vec<u8> = s.chain(p).cloned().collect();
let c = (size + U - 1) / U;
let c = size.div_ceil(U);
let mut a: Vec<u8> = vec![];
for _ in 1..c {
let ai = pbepkcs12sha1core(&d, &i, &mut a, r);
Expand Down
Loading