diff --git a/src/api2/access/acl.rs b/src/api2/access/acl.rs index 2aec4aa9..a97d0239 100644 --- a/src/api2/access/acl.rs +++ b/src/api2/access/acl.rs @@ -199,7 +199,7 @@ pub fn update_acl( bail!("parameter 'group' - groups are currently not supported."); } else if let Some(ref userid) = userid { if !delete { // Note: we allow to delete non-existent users - let (user_cfg, _) = crate::config::user::cached_config()?; + let user_cfg = crate::config::user::cached_config()?; if user_cfg.sections.get(userid).is_none() { bail!("no such user."); } diff --git a/src/config/user.rs b/src/config/user.rs index d4bfb35b..fc74ed94 100644 --- a/src/config/user.rs +++ b/src/config/user.rs @@ -141,10 +141,10 @@ pub fn config() -> Result<(SectionConfigData, [u8;32]), Error> { Ok((data, digest)) } -pub fn cached_config() -> Result<(Arc,[u8;32]), Error> { +pub fn cached_config() -> Result, Error> { struct ConfigCache { - data: Option<(Arc,[u8;32])>, + data: Option>, last_mtime: i64, last_mtime_nsec: i64, } @@ -159,21 +159,21 @@ pub fn cached_config() -> Result<(Arc,[u8;32]), Error> { { // limit scope let cache = CACHED_CONFIG.read().unwrap(); if stat.st_mtime == cache.last_mtime && stat.st_mtime_nsec == cache.last_mtime_nsec { - if let Some((ref config, ref digest)) = cache.data { - return Ok((config.clone(), *digest)); + if let Some(ref config) = cache.data { + return Ok(config.clone()); } } } - let (config, digest) = config()?; + let (config, _digest) = config()?; let config = Arc::new(config); let mut cache = CACHED_CONFIG.write().unwrap(); cache.last_mtime = stat.st_mtime; cache.last_mtime_nsec = stat.st_mtime_nsec; - cache.data = Some((config.clone(), digest.clone())); + cache.data = Some(config.clone()); - Ok((config, digest)) + Ok(config) } pub fn save_config(config: &SectionConfigData) -> Result<(), Error> {