Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Сергей Конев 2024-12-09 21:17:41 +03:00
commit ca7e4c9874
39 changed files with 136 additions and 109 deletions

View File

@ -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" }

View File

@ -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<AcmeApiConfig> = None;
static ACME_ACME_CONFIG: OnceLock<AcmeApiConfig> = OnceLock::new();
/// Initialize the global product configuration.
pub fn init<P: AsRef<Path>>(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<P: AsRef<Path>>(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 {

View File

@ -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<syn::Expr, syn::Error> {
let param_name: syn::LitStr = syn::parse2(param_tokens)?;
match self.0.find_obj_property_by_ident(&param_name.value()) {

View File

@ -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<Self::Item> {

View File

@ -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();

View File

@ -45,7 +45,7 @@ impl<R: BufRead> APTSourcesFileParser<R> {
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`.

View File

@ -42,11 +42,8 @@ fn common_digest(files: &[APTRepositoryFile]) -> ConfigDigest {
}
let mut common_raw = Vec::<u8>::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[..])

View File

@ -234,17 +234,19 @@ where
}
}
impl<'c, C> HttpApiClient for &'c C
impl<C> 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<C> HttpApiClient for std::sync::Arc<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;
@ -376,13 +380,15 @@ impl<C> HttpApiClient for std::rc::Rc<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;

View File

@ -32,7 +32,7 @@ pub struct ZstdEncoder<'a, T> {
state: EncoderState,
}
impl<'a, T, O, E> ZstdEncoder<'a, T>
impl<T, O, E> ZstdEncoder<'_, T>
where
T: Stream<Item = Result<O, E>> + Unpin,
O: Into<Bytes>,
@ -55,7 +55,7 @@ where
}
}
impl<'a, T> ZstdEncoder<'a, T> {
impl<T> 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<T, O, E> Stream for ZstdEncoder<'_, T>
where
T: Stream<Item = Result<O, E>> + Unpin,
O: Into<Bytes>,

View File

@ -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)* })() }}

View File

@ -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 {

View File

@ -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 }

View File

@ -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(

View File

@ -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<GroupConfig> = 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<FilterConfig> = 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 {

View File

@ -1,10 +1,12 @@
use std::path::Path;
use tracing::error;
pub(crate) fn attempt_file_read<P: AsRef<Path>>(path: P) -> Option<String> {
match proxmox_sys::fs::file_read_optional_string(path) {
Ok(contents) => contents,
Err(err) => {
log::error!("{err}");
error!("{err}");
None
}
}

View File

@ -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<String> {
match parsed.lookup::<DummyPbsUser>("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
}
}

View File

@ -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}"),
}
}
}

View File

@ -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");
}
}
}

View File

@ -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),
}
}

View File

@ -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")
})
}

View File

@ -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<ProxmoxProductConfig> = None;
static PRODUCT_CONFIG: OnceLock<ProxmoxProductConfig> = 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
}

View File

@ -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

View File

@ -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 <support@proxmox.com> 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

View File

@ -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.

View File

@ -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()

View File

@ -19,8 +19,8 @@ where
impl<R: Send + Sync> Records<R> {
/// 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<T>(reader: T) -> Records<BufReader<T>>
where
T: AsyncRead + Send + Sync + Unpin + 'static,

View File

@ -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<V>(self, visitor: V) -> Result<V::Value, Error>
@ -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<T>(&mut self, seed: T) -> Result<Option<T::Value>, 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<V>(self, visitor: V) -> Result<V::Value, Error>
@ -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<K>(&mut self, seed: K) -> Result<Option<K::Value>, Error>

View File

@ -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<T>(input: T) -> Self
where
T: Into<Cow<'de, str>>,
@ -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<V>(self, visitor: V) -> Result<V::Value, Error>
@ -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<T>(&mut self, seed: T) -> Result<Option<T::Value>, Error>

View File

@ -85,7 +85,7 @@ pub(crate) fn next_property(mut data: &str) -> Option<Result<NextProperty, Error
Some(Ok((key, value, data)))
}
impl<'a> std::iter::FusedIterator for PropertyIterator<'a> {}
impl std::iter::FusedIterator for PropertyIterator<'_> {}
/// Parse a quoted string and move `data` to after the closing quote.
///

View File

@ -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 {

View File

@ -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;

View File

@ -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

View File

@ -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 <support@proxmox.com> 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

View File

@ -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.

View File

@ -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<ACLTag, nix::errno::Errno> {
let mut tag = ACL_UNDEFINED_TAG;
let res = unsafe { acl_get_tag_type(self.ptr, &mut tag as *mut ACLTag) };

View File

@ -5,7 +5,6 @@ use std::path::PathBuf;
use anyhow::{bail, Error};
#[allow(clippy::manual_range_contains)]
fn parse_hex_digit(d: u8) -> Result<u8, Error> {
if d >= b'0' && d <= b'9' {
return Ok(d - b'0');

View File

@ -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
}

View File

@ -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")),
}
}

View File

@ -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 {