[pbs-devel] [PATCH proxmox-backup 2/5] fix #4382: api2: remove permissions of token on deletion

Hannes Laimer h.laimer at proxmox.com
Tue Dec 20 15:57:11 CET 2022


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 src/api2/access/user.rs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/api2/access/user.rs b/src/api2/access/user.rs
index 2264f8e8..ce676252 100644
--- a/src/api2/access/user.rs
+++ b/src/api2/access/user.rs
@@ -635,7 +635,8 @@ pub fn delete_token(
     token_name: Tokenname,
     digest: Option<String>,
 ) -> Result<(), Error> {
-    let _lock = pbs_config::user::lock_config()?;
+    let _acl_lock = pbs_config::acl::lock_config()?;
+    let _user_lock = pbs_config::user::lock_config()?;
 
     let (mut config, expected_digest) = pbs_config::user::config()?;
 
@@ -662,6 +663,10 @@ pub fn delete_token(
 
     pbs_config::user::save_config(&config)?;
 
+    let (mut tree, _digest) = pbs_config::acl::config()?;
+    tree.delete_authid(&Authid::from((userid, Some(token_name))));
+    pbs_config::acl::save_config(&tree)?;
+
     Ok(())
 }
 
-- 
2.30.2






More information about the pbs-devel mailing list