From 1b1a553741b1ab9e1a5f43ff8c06fa31e0df5b70 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 21 Sep 2021 07:58:49 +0200 Subject: [PATCH] rest server: do not use pbs_api_types::Authid Signed-off-by: Thomas Lamprecht --- src/server/rest.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/server/rest.rs b/src/server/rest.rs index d87985c1..2083743b 100644 --- a/src/server/rest.rs +++ b/src/server/rest.rs @@ -33,7 +33,6 @@ use proxmox::tools::fs::CreateOptions; use pbs_tools::compression::{DeflateEncoder, Level}; use pbs_tools::stream::AsyncReaderStream; -use pbs_api_types::Authid; use proxmox_rest_server::{ ApiConfig, FileLogger, FileLogOptions, AuthError, RestEnvironment, CompressionMethod, extract_cookie, normalize_uri_path, @@ -44,6 +43,8 @@ extern "C" { fn tzset(); } +struct AuthStringExtension(String); + struct EmptyUserInformation {} impl UserInformation for EmptyUserInformation { @@ -176,8 +177,8 @@ fn log_response( ); } if let Some(logfile) = logfile { - let auth_id = match resp.extensions().get::() { - Some(auth_id) => auth_id.to_string(), + let auth_id = match resp.extensions().get::() { + Some(AuthStringExtension(auth_id)) => auth_id.clone(), None => "-".to_string(), }; let now = proxmox::tools::time::epoch_i64(); @@ -198,6 +199,7 @@ fn log_response( )); } } + pub fn auth_logger() -> Result { let backup_user = pbs_config::backup_user()?; @@ -720,8 +722,7 @@ async fn handle_request( }; if let Some(auth_id) = auth_id { - let auth_id: Authid = auth_id.parse()?; - response.extensions_mut().insert(auth_id); + response.extensions_mut().insert(AuthStringExtension(auth_id)); } return Ok(response);