[pbs-devel] [PATCH proxmox-backup v2 11/16] rest server: do not use pbs_api_types::Authid
Dietmar Maurer
dietmar at proxmox.com
Tue Sep 21 07:58:49 CEST 2021
---
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::<Authid>() {
- Some(auth_id) => auth_id.to_string(),
+ let auth_id = match resp.extensions().get::<AuthStringExtension>() {
+ 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<FileLogger, Error> {
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);
--
2.30.2
More information about the pbs-devel
mailing list