diff --git a/Cargo.toml b/Cargo.toml index b62fcd50..7e6e151b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -143,7 +143,7 @@ proxmox-sendmail = { version = "0.1.0", path = "proxmox-sendmail" } proxmox-serde = { version = "0.1.1", path = "proxmox-serde", features = [ "serde_json" ] } proxmox-shared-memory = { version = "0.3.0", path = "proxmox-shared-memory" } proxmox-sortable-macro = { version = "0.1.3", path = "proxmox-sortable-macro" } -proxmox-sys = { version = "0.6.0", path = "proxmox-sys" } +proxmox-sys = { version = "0.6.5", path = "proxmox-sys" } proxmox-systemd = { version = "0.1.0", path = "proxmox-systemd" } proxmox-tfa = { version = "5.0.0", path = "proxmox-tfa" } proxmox-time = { version = "2.0.0", path = "proxmox-time" } diff --git a/proxmox-acme-api/src/init.rs b/proxmox-acme-api/src/init.rs index a5287a8e..5dcf048c 100644 --- a/proxmox-acme-api/src/init.rs +++ b/proxmox-acme-api/src/init.rs @@ -1,26 +1,28 @@ use std::path::{Path, PathBuf}; +use std::sync::OnceLock; use anyhow::Error; use proxmox_product_config::create_secret_dir; +#[derive(Debug)] struct AcmeApiConfig { acme_config_dir: PathBuf, acme_account_dir: PathBuf, } -static mut ACME_ACME_CONFIG: Option = None; +static ACME_ACME_CONFIG: OnceLock = OnceLock::new(); /// Initialize the global product configuration. pub fn init>(acme_config_dir: P, create_subdirs: bool) -> Result<(), Error> { let acme_config_dir = acme_config_dir.as_ref().to_owned(); - unsafe { - ACME_ACME_CONFIG = Some(AcmeApiConfig { + ACME_ACME_CONFIG + .set(AcmeApiConfig { acme_account_dir: acme_config_dir.join("accounts"), acme_config_dir, - }); - } + }) + .expect("cannot set acme configuration twice"); if create_subdirs { create_secret_dir(self::acme_config_dir(), false)?; @@ -31,11 +33,9 @@ pub fn init>(acme_config_dir: P, create_subdirs: bool) -> Result< } fn acme_api_config() -> &'static AcmeApiConfig { - unsafe { - ACME_ACME_CONFIG - .as_ref() - .expect("ProxmoxProductConfig is not initialized!") - } + ACME_ACME_CONFIG + .get() + .expect("ProxmoxProductConfig is not initialized!") } fn acme_config_dir() -> &'static Path { diff --git a/proxmox-api-macro/src/api/method.rs b/proxmox-api-macro/src/api/method.rs index fd961cae..d170a9d5 100644 --- a/proxmox-api-macro/src/api/method.rs +++ b/proxmox-api-macro/src/api/method.rs @@ -935,7 +935,7 @@ fn serialize_input_schema( struct DefaultParameters<'a>(&'a Schema); -impl<'a> VisitMut for DefaultParameters<'a> { +impl VisitMut for DefaultParameters<'_> { fn visit_expr_mut(&mut self, i: &mut syn::Expr) { if let syn::Expr::Macro(exprmac) = i { if exprmac.mac.path.is_ident("api_get_default") { @@ -955,7 +955,7 @@ impl<'a> VisitMut for DefaultParameters<'a> { } } -impl<'a> DefaultParameters<'a> { +impl DefaultParameters<'_> { fn get_default(&self, param_tokens: TokenStream) -> Result { let param_name: syn::LitStr = syn::parse2(param_tokens)?; match self.0.find_obj_property_by_ident(¶m_name.value()) { diff --git a/proxmox-api-macro/src/util.rs b/proxmox-api-macro/src/util.rs index adacd225..11a83e46 100644 --- a/proxmox-api-macro/src/util.rs +++ b/proxmox-api-macro/src/util.rs @@ -689,7 +689,7 @@ pub struct DerivedItems<'a> { attributes: std::slice::Iter<'a, syn::Attribute>, } -impl<'a> Iterator for DerivedItems<'a> { +impl Iterator for DerivedItems<'_> { type Item = syn::Path; fn next(&mut self) -> Option { diff --git a/proxmox-apt/src/repositories/file.rs b/proxmox-apt/src/repositories/file.rs index fc465b28..9edaa59e 100644 --- a/proxmox-apt/src/repositories/file.rs +++ b/proxmox-apt/src/repositories/file.rs @@ -394,10 +394,7 @@ impl APTRepositoryFileImpl for APTRepositoryFile { }; for (n, repo) in self.repositories.iter().enumerate() { - let mut origin = match repo.get_cached_origin(apt_lists_dir) { - Ok(option) => option, - Err(_) => None, - }; + let mut origin = repo.get_cached_origin(apt_lists_dir).unwrap_or_default(); if origin.is_none() { origin = repo.origin_from_uris(); diff --git a/proxmox-apt/src/repositories/file/sources_parser.rs b/proxmox-apt/src/repositories/file/sources_parser.rs index f58ce17b..b6a4b16c 100644 --- a/proxmox-apt/src/repositories/file/sources_parser.rs +++ b/proxmox-apt/src/repositories/file/sources_parser.rs @@ -45,7 +45,7 @@ impl APTSourcesFileParser { if key.starts_with('-') { return false; }; - return key.chars().all(|c| matches!(c, '!'..='9' | ';'..='~')); + key.chars().all(|c| matches!(c, '!'..='9' | ';'..='~')) } /// Try parsing a repository in stanza format from `lines`. diff --git a/proxmox-apt/src/repositories/mod.rs b/proxmox-apt/src/repositories/mod.rs index 1af20115..8cd2cd2f 100644 --- a/proxmox-apt/src/repositories/mod.rs +++ b/proxmox-apt/src/repositories/mod.rs @@ -42,11 +42,8 @@ fn common_digest(files: &[APTRepositoryFile]) -> ConfigDigest { } let mut common_raw = Vec::::with_capacity(digests.len() * 32); - for digest in digests.values() { - match digest { - Some(digest) => common_raw.extend_from_slice(&digest[..]), - None => (), - } + for digest in digests.into_values().flatten() { + common_raw.extend_from_slice(&digest[..]); } ConfigDigest::from_slice(&common_raw[..]) diff --git a/proxmox-client/src/lib.rs b/proxmox-client/src/lib.rs index c6e3cf02..00c48665 100644 --- a/proxmox-client/src/lib.rs +++ b/proxmox-client/src/lib.rs @@ -234,17 +234,19 @@ where } } -impl<'c, C> HttpApiClient for &'c C +impl HttpApiClient for &C where C: HttpApiClient, { - type ResponseFuture<'a> = C::ResponseFuture<'a> + type ResponseFuture<'a> + = C::ResponseFuture<'a> where Self: 'a; type Body = C::Body; - type ResponseStreamFuture<'a> = C::ResponseStreamFuture<'a> + type ResponseStreamFuture<'a> + = C::ResponseStreamFuture<'a> where Self: 'a; @@ -307,13 +309,15 @@ impl HttpApiClient for std::sync::Arc where C: HttpApiClient, { - type ResponseFuture<'a> = C::ResponseFuture<'a> + type ResponseFuture<'a> + = C::ResponseFuture<'a> where Self: 'a; type Body = C::Body; - type ResponseStreamFuture<'a> = C::ResponseStreamFuture<'a> + type ResponseStreamFuture<'a> + = C::ResponseStreamFuture<'a> where Self: 'a; @@ -376,13 +380,15 @@ impl HttpApiClient for std::rc::Rc where C: HttpApiClient, { - type ResponseFuture<'a> = C::ResponseFuture<'a> + type ResponseFuture<'a> + = C::ResponseFuture<'a> where Self: 'a; type Body = C::Body; - type ResponseStreamFuture<'a> = C::ResponseStreamFuture<'a> + type ResponseStreamFuture<'a> + = C::ResponseStreamFuture<'a> where Self: 'a; diff --git a/proxmox-compression/src/zstd.rs b/proxmox-compression/src/zstd.rs index d73610b7..7e303833 100644 --- a/proxmox-compression/src/zstd.rs +++ b/proxmox-compression/src/zstd.rs @@ -32,7 +32,7 @@ pub struct ZstdEncoder<'a, T> { state: EncoderState, } -impl<'a, T, O, E> ZstdEncoder<'a, T> +impl ZstdEncoder<'_, T> where T: Stream> + Unpin, O: Into, @@ -55,7 +55,7 @@ where } } -impl<'a, T> ZstdEncoder<'a, T> { +impl ZstdEncoder<'_, T> { /// Returns the wrapped [Stream] pub fn into_inner(self) -> T { self.inner @@ -80,7 +80,7 @@ impl<'a, T> ZstdEncoder<'a, T> { } } -impl<'a, T, O, E> Stream for ZstdEncoder<'a, T> +impl Stream for ZstdEncoder<'_, T> where T: Stream> + Unpin, O: Into, diff --git a/proxmox-lang/src/lib.rs b/proxmox-lang/src/lib.rs index cf191c0b..0abfd507 100644 --- a/proxmox-lang/src/lib.rs +++ b/proxmox-lang/src/lib.rs @@ -31,7 +31,6 @@ pub mod ops; /// }) /// .map_err(|e| format_err!("my try block returned an error - {}", e)); /// ``` - #[macro_export] macro_rules! try_block { { $($token:tt)* } => {{ (|| -> Result<_,_> { $($token)* })() }} diff --git a/proxmox-ldap/src/lib.rs b/proxmox-ldap/src/lib.rs index 4766f338..31f118ad 100644 --- a/proxmox-ldap/src/lib.rs +++ b/proxmox-ldap/src/lib.rs @@ -392,7 +392,7 @@ enum FilterElement<'a> { Verbatim(&'a str), } -impl<'a> Display for FilterElement<'a> { +impl Display for FilterElement<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { fn write_children(f: &mut Formatter<'_>, children: &[FilterElement]) -> std::fmt::Result { for child in children { diff --git a/proxmox-notify/Cargo.toml b/proxmox-notify/Cargo.toml index 725bd210..5c700ca8 100644 --- a/proxmox-notify/Cargo.toml +++ b/proxmox-notify/Cargo.toml @@ -18,7 +18,7 @@ const_format.workspace = true handlebars = { workspace = true } http = { workspace = true, optional = true } lettre = { workspace = true, optional = true } -log.workspace = true +tracing.workspace = true mail-parser = { workspace = true, optional = true } openssl.workspace = true percent-encoding = { workspace = true, optional = true } diff --git a/proxmox-notify/src/api/webhook.rs b/proxmox-notify/src/api/webhook.rs index f786c36b..31c5c869 100644 --- a/proxmox-notify/src/api/webhook.rs +++ b/proxmox-notify/src/api/webhook.rs @@ -128,7 +128,7 @@ pub fn add_endpoint( /// Returns a `HttpError` if: /// - the passed `digest` does not match (`400 Bad request`) /// - parameters are ill-formed (empty header value, invalid base64, unknown header/secret) -/// (`400 Bad request`) +/// (`400 Bad request`) /// - an entity with the same name already exists (`400 Bad request`) /// - the configuration could not be saved (`500 Internal server error`) pub fn update_endpoint( diff --git a/proxmox-notify/src/config.rs b/proxmox-notify/src/config.rs index 4d0b53f7..791e0b5f 100644 --- a/proxmox-notify/src/config.rs +++ b/proxmox-notify/src/config.rs @@ -1,5 +1,7 @@ use std::sync::OnceLock; +use tracing::warn; + use proxmox_schema::{ApiType, ObjectSchema}; use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin}; @@ -148,7 +150,7 @@ pub fn config(raw_config: &str) -> Result<(SectionConfigData, [u8; 32]), Error> // This mechanism cleans out left-over entries. let entries: Vec = data.convert_to_typed_array("group").unwrap_or_default(); if !entries.is_empty() { - log::warn!("clearing left-over 'group' entries from notifications.cfg"); + warn!("clearing left-over 'group' entries from notifications.cfg"); } for entry in entries { @@ -157,7 +159,7 @@ pub fn config(raw_config: &str) -> Result<(SectionConfigData, [u8; 32]), Error> let entries: Vec = data.convert_to_typed_array("filter").unwrap_or_default(); if !entries.is_empty() { - log::warn!("clearing left-over 'filter' entries from notifications.cfg"); + warn!("clearing left-over 'filter' entries from notifications.cfg"); } for entry in entries { diff --git a/proxmox-notify/src/context/common.rs b/proxmox-notify/src/context/common.rs index 7580bd1a..88bacf52 100644 --- a/proxmox-notify/src/context/common.rs +++ b/proxmox-notify/src/context/common.rs @@ -1,10 +1,12 @@ use std::path::Path; +use tracing::error; + pub(crate) fn attempt_file_read>(path: P) -> Option { match proxmox_sys::fs::file_read_optional_string(path) { Ok(contents) => contents, Err(err) => { - log::error!("{err}"); + error!("{err}"); None } } diff --git a/proxmox-notify/src/context/pbs.rs b/proxmox-notify/src/context/pbs.rs index 09c555e4..cd117646 100644 --- a/proxmox-notify/src/context/pbs.rs +++ b/proxmox-notify/src/context/pbs.rs @@ -1,6 +1,8 @@ -use serde::Deserialize; use std::path::Path; +use serde::Deserialize; +use tracing::error; + use proxmox_schema::{ObjectSchema, Schema, StringSchema}; use proxmox_section_config::{SectionConfig, SectionConfigPlugin}; @@ -46,13 +48,13 @@ fn lookup_mail_address(content: &str, username: &str) -> Option { match parsed.lookup::("user", username) { Ok(user) => common::normalize_for_return(user.email.as_deref()), Err(err) => { - log::error!("unable to parse {PBS_USER_CFG_FILENAME}: {err}"); + error!("unable to parse {PBS_USER_CFG_FILENAME}: {err}"); None } } } Err(err) => { - log::error!("unable to parse {PBS_USER_CFG_FILENAME}: {err}"); + error!("unable to parse {PBS_USER_CFG_FILENAME}: {err}"); None } } diff --git a/proxmox-notify/src/endpoints/smtp.rs b/proxmox-notify/src/endpoints/smtp.rs index 973f7fad..6bb2d2d0 100644 --- a/proxmox-notify/src/endpoints/smtp.rs +++ b/proxmox-notify/src/endpoints/smtp.rs @@ -336,7 +336,7 @@ impl Endpoint for SmtpEndpoint { let header = HeaderValue::new(name, value); message.headers_mut().insert_raw(header); } - Err(e) => log::error!("could not set header: {e}"), + Err(e) => error!("could not set header: {e}"), } } } diff --git a/proxmox-notify/src/lib.rs b/proxmox-notify/src/lib.rs index 12f3866b..12e59474 100644 --- a/proxmox-notify/src/lib.rs +++ b/proxmox-notify/src/lib.rs @@ -9,6 +9,7 @@ use context::context; use serde::{Deserialize, Serialize}; use serde_json::json; use serde_json::Value; +use tracing::{error, info}; use proxmox_schema::api; use proxmox_section_config::SectionConfigData; @@ -299,9 +300,7 @@ impl Config { if let Some(obj) = value.as_object_mut() { obj.insert("origin".to_string(), Value::String("builtin".into())); } else { - log::error!( - "section config entry is not an object. This should not happen" - ); + error!("section config entry is not an object. This should not happen"); } } else { // Entry is built-in, but it has been modified by the user. @@ -311,9 +310,7 @@ impl Config { Value::String("modified-builtin".into()), ); } else { - log::error!( - "section config entry is not an object. This should not happen" - ); + error!("section config entry is not an object. This should not happen"); } } } else { @@ -322,7 +319,7 @@ impl Config { if let Some(obj) = val.as_object_mut() { obj.insert("origin".to_string(), Value::String("builtin".into())); } else { - log::error!("section config entry is not an object. This should not happen"); + error!("section config entry is not an object. This should not happen"); } config .set_data(key, builtin_typename, val) @@ -356,7 +353,7 @@ impl Config { if let Some(obj) = value.as_object_mut() { obj.remove("origin"); } else { - log::error!("section config entry is not an object. This should not happen"); + error!("section config entry is not an object. This should not happen"); } } @@ -397,7 +394,7 @@ macro_rules! parse_endpoints_with_private_config { match $config.private_config.sections.get(&config.name) { Some((section_type_name, private_config)) => { if $type_name != section_type_name { - log::error!( + error!( "Could not instantiate endpoint '{name}': \ private config has wrong type", name = config.name @@ -411,7 +408,7 @@ macro_rules! parse_endpoints_with_private_config { private_config: private_config.clone(), })); } - None => log::error!( + None => error!( "Could not instantiate endpoint '{name}': \ private config does not exist", name = config.name @@ -551,21 +548,21 @@ impl Bus { if endpoint.disabled() { // Skip this target if it is disabled - log::info!("skipping disabled target '{name}'"); + info!("skipping disabled target '{name}'"); continue; } match endpoint.send(notification) { Ok(_) => { - log::info!("notified via target `{name}`"); + info!("notified via target `{name}`"); } Err(e) => { // Only log on errors, do not propagate fail to the caller. - log::error!("could not notify via target `{name}`: {e}"); + error!("could not notify via target `{name}`: {e}"); } } } else { - log::error!("could not notify via target '{target}', it does not exist"); + error!("could not notify via target '{target}', it does not exist"); } } } diff --git a/proxmox-notify/src/matcher.rs b/proxmox-notify/src/matcher.rs index 7fb2c9b1..083c2dbd 100644 --- a/proxmox-notify/src/matcher.rs +++ b/proxmox-notify/src/matcher.rs @@ -6,6 +6,7 @@ use std::str::FromStr; use const_format::concatcp; use regex::Regex; use serde::{Deserialize, Serialize}; +use tracing::{error, info}; use proxmox_schema::api_types::{COMMENT_SCHEMA, SAFE_ID_REGEX_STR}; use proxmox_schema::{api, const_regex, ApiStringFormat, Schema, StringSchema, Updater}; @@ -445,7 +446,7 @@ pub fn check_matches<'a>( for matcher in matchers { if matcher.disable.unwrap_or_default() { // Skip this matcher if it is disabled - log::info!("skipping disabled matcher '{name}'", name = matcher.name); + info!("skipping disabled matcher '{name}'", name = matcher.name); continue; } @@ -454,7 +455,7 @@ pub fn check_matches<'a>( let t = t.unwrap_or_default(); targets.extend(t.iter().map(|s| s.as_str())); } - Err(err) => log::error!("matcher '{matcher}' failed: {err}", matcher = matcher.name), + Err(err) => error!("matcher '{matcher}' failed: {err}", matcher = matcher.name), } } diff --git a/proxmox-notify/src/renderer/mod.rs b/proxmox-notify/src/renderer/mod.rs index 393cbbf2..e058ea22 100644 --- a/proxmox-notify/src/renderer/mod.rs +++ b/proxmox-notify/src/renderer/mod.rs @@ -8,6 +8,7 @@ use handlebars::{ }; use serde::{Deserialize, Serialize}; use serde_json::Value; +use tracing::error; use proxmox_human_byte::HumanByte; use proxmox_time::TimeSpan; @@ -142,7 +143,7 @@ impl ValueRenderFunction { ValueRenderFunction::Timestamp => value_to_timestamp(value), } .unwrap_or_else(|| { - log::error!("could not render value {value} with renderer {self:?}"); + error!("could not render value {value} with renderer {self:?}"); String::from("ERROR") }) } diff --git a/proxmox-product-config/src/init.rs b/proxmox-product-config/src/init.rs index a244559a..1bc47110 100644 --- a/proxmox-product-config/src/init.rs +++ b/proxmox-product-config/src/init.rs @@ -1,18 +1,21 @@ +use std::sync::OnceLock; + +#[derive(Debug)] struct ProxmoxProductConfig { api_user: nix::unistd::User, priv_user: nix::unistd::User, } -static mut PRODUCT_CONFIG: Option = None; +static PRODUCT_CONFIG: OnceLock = OnceLock::new(); /// Initialize the global product configuration. pub fn init(api_user: nix::unistd::User, priv_user: nix::unistd::User) { - unsafe { - PRODUCT_CONFIG = Some(ProxmoxProductConfig { + PRODUCT_CONFIG + .set(ProxmoxProductConfig { api_user, priv_user, - }); - } + }) + .expect("cannot init proxmox product config twice"); } /// Returns the global api user set with [init]. @@ -21,12 +24,10 @@ pub fn init(api_user: nix::unistd::User, priv_user: nix::unistd::User) { /// /// Panics if [init] wasn't called before. pub fn get_api_user() -> &'static nix::unistd::User { - unsafe { - &PRODUCT_CONFIG - .as_ref() - .expect("ProxmoxProductConfig is not initialized!") - .api_user - } + &PRODUCT_CONFIG + .get() + .expect("ProxmoxProductConfig is not initialized!") + .api_user } // Returns the global privileged user set with [init]. @@ -35,10 +36,8 @@ pub fn get_api_user() -> &'static nix::unistd::User { /// /// Panics if [init] wasn't called before. pub fn get_priv_user() -> &'static nix::unistd::User { - unsafe { - &PRODUCT_CONFIG - .as_ref() - .expect("ProxmoxProductConfig is not initialized!") - .priv_user - } + &PRODUCT_CONFIG + .get() + .expect("ProxmoxProductConfig is not initialized!") + .priv_user } diff --git a/proxmox-rest-server/Cargo.toml b/proxmox-rest-server/Cargo.toml index 0c60bc54..bfd2d5f7 100644 --- a/proxmox-rest-server/Cargo.toml +++ b/proxmox-rest-server/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "proxmox-rest-server" description = "REST server implementation" -version = "0.8.4" +version = "0.8.5" authors.workspace = true edition.workspace = true diff --git a/proxmox-rest-server/debian/changelog b/proxmox-rest-server/debian/changelog index f8d92f2e..f43a259f 100644 --- a/proxmox-rest-server/debian/changelog +++ b/proxmox-rest-server/debian/changelog @@ -1,3 +1,18 @@ +rust-proxmox-rest-server (0.8.5-1) bookworm; urgency=medium + + * update proxmox-http-client to 0.9.4 + + * handle failure in worker task setup correctly to avoid a reference count + issue with active workers that can keep an old API daemon alive on reload, + e.g. on package upgrade. + + * close race window when updating worker task count + + * increase task index lock timeout to 15s to handle overloaded systems + better while still not waiting overly long. + + -- Proxmox Support Team Mon, 02 Dec 2024 18:11:47 +0100 + rust-proxmox-rest-server (0.8.4-1) bookworm; urgency=medium * add custom handlebars escape fn and skip escaping the '=' charater. This diff --git a/proxmox-rest-server/debian/control b/proxmox-rest-server/debian/control index ab0a84a2..42ee9f26 100644 --- a/proxmox-rest-server/debian/control +++ b/proxmox-rest-server/debian/control @@ -100,8 +100,8 @@ Provides: librust-proxmox-rest-server-0+default-dev (= ${binary:Version}), librust-proxmox-rest-server-0.8-dev (= ${binary:Version}), librust-proxmox-rest-server-0.8+default-dev (= ${binary:Version}), - librust-proxmox-rest-server-0.8.4-dev (= ${binary:Version}), - librust-proxmox-rest-server-0.8.4+default-dev (= ${binary:Version}) + librust-proxmox-rest-server-0.8.5-dev (= ${binary:Version}), + librust-proxmox-rest-server-0.8.5+default-dev (= ${binary:Version}) Description: REST server implementation - Rust source code Source code for Debianized Rust crate "proxmox-rest-server" @@ -116,7 +116,7 @@ Depends: Provides: librust-proxmox-rest-server-0+rate-limited-stream-dev (= ${binary:Version}), librust-proxmox-rest-server-0.8+rate-limited-stream-dev (= ${binary:Version}), - librust-proxmox-rest-server-0.8.4+rate-limited-stream-dev (= ${binary:Version}) + librust-proxmox-rest-server-0.8.5+rate-limited-stream-dev (= ${binary:Version}) Description: REST server implementation - feature "rate-limited-stream" This metapackage enables feature "rate-limited-stream" for the Rust proxmox- rest-server crate, by pulling in any additional dependencies needed by that @@ -132,7 +132,7 @@ Depends: Provides: librust-proxmox-rest-server-0+templates-dev (= ${binary:Version}), librust-proxmox-rest-server-0.8+templates-dev (= ${binary:Version}), - librust-proxmox-rest-server-0.8.4+templates-dev (= ${binary:Version}) + librust-proxmox-rest-server-0.8.5+templates-dev (= ${binary:Version}) Description: REST server implementation - feature "templates" This metapackage enables feature "templates" for the Rust proxmox-rest-server crate, by pulling in any additional dependencies needed by that feature. diff --git a/proxmox-router/src/cli/mod.rs b/proxmox-router/src/cli/mod.rs index 2b5a69c8..2393da31 100644 --- a/proxmox-router/src/cli/mod.rs +++ b/proxmox-router/src/cli/mod.rs @@ -306,7 +306,7 @@ impl CliCommandMap { /// Builder style method to set extra options for the entire set of subcommands, taking a /// prepared `GlobalOptions` for potential /// Can be used multiple times. - + /// /// Finish the command line interface. pub fn build(self) -> CommandLineInterface { self.into() diff --git a/proxmox-router/src/stream/parsing.rs b/proxmox-router/src/stream/parsing.rs index 4e13d687..69ae1994 100644 --- a/proxmox-router/src/stream/parsing.rs +++ b/proxmox-router/src/stream/parsing.rs @@ -19,8 +19,8 @@ where impl Records { /// Create a *new buffered reader* for to cerate a record stream from an [`AsyncRead`]. - /// Note: If the underlying type already implements [`AsyncBufRead`], use [`Records::::from`] - /// isntead! + /// Note: If the underlying type already implements [`AsyncBufRead`], use [`Records::from`] + /// instead! pub fn new(reader: T) -> Records> where T: AsyncRead + Send + Sync + Unpin + 'static, diff --git a/proxmox-schema/src/de/mod.rs b/proxmox-schema/src/de/mod.rs index 79fb18e7..52897fea 100644 --- a/proxmox-schema/src/de/mod.rs +++ b/proxmox-schema/src/de/mod.rs @@ -155,7 +155,7 @@ impl<'de, 'i> SchemaDeserializer<'de, 'i> { } } -impl<'de, 'i> de::Deserializer<'de> for SchemaDeserializer<'de, 'i> { +impl<'de> de::Deserializer<'de> for SchemaDeserializer<'de, '_> { type Error = Error; fn deserialize_any(self, visitor: V) -> Result @@ -410,7 +410,7 @@ impl<'o, 'i, 's> SeqAccess<'o, 'i, 's> { } } -impl<'de, 'i, 's> de::SeqAccess<'de> for SeqAccess<'de, 'i, 's> { +impl<'de> de::SeqAccess<'de> for SeqAccess<'de, '_, '_> { type Error = Error; fn next_element_seed(&mut self, seed: T) -> Result, Error> @@ -448,7 +448,7 @@ impl<'de, 'i, 's> de::SeqAccess<'de> for SeqAccess<'de, 'i, 's> { } } -impl<'de, 'i, 's> de::Deserializer<'de> for SeqAccess<'de, 'i, 's> { +impl<'de> de::Deserializer<'de> for SeqAccess<'de, '_, '_> { type Error = Error; fn deserialize_any(self, visitor: V) -> Result @@ -538,7 +538,7 @@ impl<'de, 'i> MapAccess<'de, 'i> { } } -impl<'de, 'i> de::MapAccess<'de> for MapAccess<'de, 'i> { +impl<'de> de::MapAccess<'de> for MapAccess<'de, '_> { type Error = Error; fn next_key_seed(&mut self, seed: K) -> Result, Error> diff --git a/proxmox-schema/src/de/no_schema.rs b/proxmox-schema/src/de/no_schema.rs index 45fe08cd..747ef44a 100644 --- a/proxmox-schema/src/de/no_schema.rs +++ b/proxmox-schema/src/de/no_schema.rs @@ -12,7 +12,7 @@ pub struct NoSchemaDeserializer<'de, 'i> { input: Cow3<'de, 'i, str>, } -impl<'de, 'i> NoSchemaDeserializer<'de, 'i> { +impl<'de> NoSchemaDeserializer<'de, '_> { pub fn new(input: T) -> Self where T: Into>, @@ -35,7 +35,7 @@ macro_rules! deserialize_num { )*} } -impl<'de, 'i> de::Deserializer<'de> for NoSchemaDeserializer<'de, 'i> { +impl<'de> de::Deserializer<'de> for NoSchemaDeserializer<'de, '_> { type Error = Error; fn deserialize_any(self, visitor: V) -> Result @@ -264,7 +264,7 @@ impl<'de, 'i> SimpleSeqAccess<'de, 'i> { } } -impl<'de, 'i> de::SeqAccess<'de> for SimpleSeqAccess<'de, 'i> { +impl<'de> de::SeqAccess<'de> for SimpleSeqAccess<'de, '_> { type Error = Error; fn next_element_seed(&mut self, seed: T) -> Result, Error> diff --git a/proxmox-schema/src/property_string.rs b/proxmox-schema/src/property_string.rs index 7b5a4ed1..e0620115 100644 --- a/proxmox-schema/src/property_string.rs +++ b/proxmox-schema/src/property_string.rs @@ -85,7 +85,7 @@ pub(crate) fn next_property(mut data: &str) -> Option std::iter::FusedIterator for PropertyIterator<'a> {} +impl std::iter::FusedIterator for PropertyIterator<'_> {} /// Parse a quoted string and move `data` to after the closing quote. /// diff --git a/proxmox-schema/src/upid.rs b/proxmox-schema/src/upid.rs index 0c68871e..9bbb66a1 100644 --- a/proxmox-schema/src/upid.rs +++ b/proxmox-schema/src/upid.rs @@ -123,7 +123,7 @@ impl<'de> serde::Deserialize<'de> for UPID { { struct ForwardToStrVisitor; - impl<'a> serde::de::Visitor<'a> for ForwardToStrVisitor { + impl serde::de::Visitor<'_> for ForwardToStrVisitor { type Value = UPID; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/proxmox-sendmail/src/lib.rs b/proxmox-sendmail/src/lib.rs index e7e2982f..050c3322 100644 --- a/proxmox-sendmail/src/lib.rs +++ b/proxmox-sendmail/src/lib.rs @@ -71,7 +71,7 @@ struct Attachment<'a> { content: &'a [u8], } -impl<'a> Attachment<'a> { +impl Attachment<'_> { fn format_attachment(&self, file_boundary: &str) -> String { use std::fmt::Write; diff --git a/proxmox-sys/Cargo.toml b/proxmox-sys/Cargo.toml index 4d578906..61ac9610 100644 --- a/proxmox-sys/Cargo.toml +++ b/proxmox-sys/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "proxmox-sys" description = "System tools (using nix)." -version = "0.6.4" +version = "0.6.5" authors.workspace = true edition.workspace = true diff --git a/proxmox-sys/debian/changelog b/proxmox-sys/debian/changelog index 65cda1b1..402982af 100644 --- a/proxmox-sys/debian/changelog +++ b/proxmox-sys/debian/changelog @@ -1,3 +1,13 @@ +rust-proxmox-sys (0.6.5-1) bookworm; urgency=medium + + * sys: fs: set CLOEXEC when creating temp files to avoid passing them to + other processes without them being aware about these FDs. This can, for + example, happen on our rest-server daemon reload. + + * sys: open directories with O_CLOEXEC with similar intention than above + + -- Proxmox Support Team Tue, 03 Dec 2024 17:41:21 +0100 + rust-proxmox-sys (0.6.4-1) bookworm; urgency=medium * drop unnecessary not-empty check on fixed-size array diff --git a/proxmox-sys/debian/control b/proxmox-sys/debian/control index 7651fad0..18a53ad8 100644 --- a/proxmox-sys/debian/control +++ b/proxmox-sys/debian/control @@ -58,10 +58,10 @@ Provides: librust-proxmox-sys-0.6+acl-dev (= ${binary:Version}), librust-proxmox-sys-0.6+default-dev (= ${binary:Version}), librust-proxmox-sys-0.6+timer-dev (= ${binary:Version}), - librust-proxmox-sys-0.6.4-dev (= ${binary:Version}), - librust-proxmox-sys-0.6.4+acl-dev (= ${binary:Version}), - librust-proxmox-sys-0.6.4+default-dev (= ${binary:Version}), - librust-proxmox-sys-0.6.4+timer-dev (= ${binary:Version}) + librust-proxmox-sys-0.6.5-dev (= ${binary:Version}), + librust-proxmox-sys-0.6.5+acl-dev (= ${binary:Version}), + librust-proxmox-sys-0.6.5+default-dev (= ${binary:Version}), + librust-proxmox-sys-0.6.5+timer-dev (= ${binary:Version}) Description: System tools (using nix) - Rust source code Source code for Debianized Rust crate "proxmox-sys" @@ -75,7 +75,7 @@ Depends: Provides: librust-proxmox-sys-0+crypt-dev (= ${binary:Version}), librust-proxmox-sys-0.6+crypt-dev (= ${binary:Version}), - librust-proxmox-sys-0.6.4+crypt-dev (= ${binary:Version}) + librust-proxmox-sys-0.6.5+crypt-dev (= ${binary:Version}) Description: System tools (using nix) - feature "crypt" This metapackage enables feature "crypt" for the Rust proxmox-sys crate, by pulling in any additional dependencies needed by that feature. @@ -91,7 +91,7 @@ Depends: Provides: librust-proxmox-sys-0+logrotate-dev (= ${binary:Version}), librust-proxmox-sys-0.6+logrotate-dev (= ${binary:Version}), - librust-proxmox-sys-0.6.4+logrotate-dev (= ${binary:Version}) + librust-proxmox-sys-0.6.5+logrotate-dev (= ${binary:Version}) Description: System tools (using nix) - feature "logrotate" This metapackage enables feature "logrotate" for the Rust proxmox-sys crate, by pulling in any additional dependencies needed by that feature. diff --git a/proxmox-sys/src/fs/acl.rs b/proxmox-sys/src/fs/acl.rs index 6f256008..5ae69296 100644 --- a/proxmox-sys/src/fs/acl.rs +++ b/proxmox-sys/src/fs/acl.rs @@ -178,7 +178,7 @@ pub struct ACLEntry<'a> { _phantom: PhantomData<&'a mut ()>, } -impl<'a> ACLEntry<'a> { +impl ACLEntry<'_> { pub fn get_tag_type(&self) -> Result { let mut tag = ACL_UNDEFINED_TAG; let res = unsafe { acl_get_tag_type(self.ptr, &mut tag as *mut ACLTag) }; diff --git a/proxmox-sys/src/systemd.rs b/proxmox-sys/src/systemd.rs index d5284090..43dc5185 100644 --- a/proxmox-sys/src/systemd.rs +++ b/proxmox-sys/src/systemd.rs @@ -5,7 +5,6 @@ use std::path::PathBuf; use anyhow::{bail, Error}; #[allow(clippy::manual_range_contains)] - fn parse_hex_digit(d: u8) -> Result { if d >= b'0' && d <= b'9' { return Ok(d - b'0'); diff --git a/proxmox-tfa/src/api/webauthn.rs b/proxmox-tfa/src/api/webauthn.rs index 4c854011..1793df97 100644 --- a/proxmox-tfa/src/api/webauthn.rs +++ b/proxmox-tfa/src/api/webauthn.rs @@ -123,7 +123,7 @@ pub(super) struct WebauthnConfigInstance<'a> { /// /// Note that we may consider changing this so `get_origin` returns the `Host:` header provided by /// the connecting client. -impl<'a> webauthn_rs::WebauthnConfig for WebauthnConfigInstance<'a> { +impl webauthn_rs::WebauthnConfig for WebauthnConfigInstance<'_> { fn get_relying_party_name(&self) -> &str { self.rp } diff --git a/proxmox-time/src/week_days.rs b/proxmox-time/src/week_days.rs index da446c5b..c409d292 100644 --- a/proxmox-time/src/week_days.rs +++ b/proxmox-time/src/week_days.rs @@ -28,7 +28,7 @@ fn parse_weekday(i: &str) -> IResult<&str, WeekDays> { "friday" | "fri" => Ok((i, WeekDays::FRIDAY)), "saturday" | "sat" => Ok((i, WeekDays::SATURDAY)), "sunday" | "sun" => Ok((i, WeekDays::SUNDAY)), - _ => return Err(parse_error(text, "weekday")), + _ => Err(parse_error(text, "weekday")), } } diff --git a/proxmox-uuid/src/lib.rs b/proxmox-uuid/src/lib.rs index cd55a540..09a70b49 100644 --- a/proxmox-uuid/src/lib.rs +++ b/proxmox-uuid/src/lib.rs @@ -201,7 +201,7 @@ impl<'de> serde::Deserialize<'de> for Uuid { struct ForwardToStrVisitor; - impl<'a> serde::de::Visitor<'a> for ForwardToStrVisitor { + impl serde::de::Visitor<'_> for ForwardToStrVisitor { type Value = Uuid; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {