diff --git a/data/auth.sqlite b/data/auth.sqlite index 0c58056..ca8463d 100644 Binary files a/data/auth.sqlite and b/data/auth.sqlite differ diff --git a/vendor/smb-server/src/fs/local.rs b/vendor/smb-server/src/fs/local.rs index a44135a..340692b 100644 --- a/vendor/smb-server/src/fs/local.rs +++ b/vendor/smb-server/src/fs/local.rs @@ -43,6 +43,7 @@ use crate::path::SmbPath; /// Cheap to clone: internally an `Arc` plus a flag. pub struct LocalFsBackend { root: Arc, + root_path: PathBuf, // Store absolute path for xattr operations read_only: bool, } @@ -50,9 +51,11 @@ impl LocalFsBackend { /// Open `path` as the share root. Errors if the path does not exist or is /// not a directory. pub fn new(path: impl AsRef) -> io::Result { - let dir = Dir::open_ambient_dir(path, ambient_authority())?; + let p = path.as_ref().canonicalize()?; + let dir = Dir::open_ambient_dir(&p, ambient_authority())?; Ok(Self { root: Arc::new(dir), + root_path: p, read_only: false, }) } @@ -431,14 +434,12 @@ impl ShareBackend for LocalFsBackend { async fn get_xattr(&self, path: &SmbPath, name: &str) -> SmbResult> { let rel = to_rel_path(path); - let root = Arc::clone(&self.root); + let root_path = self.root_path.clone(); let xattr_name = name.to_string(); spawn_blocking(move || { - // Get absolute path: dereference Arc first - let full_path = (*root).as_std_path().join(&rel); + let full_path = root_path.join(&rel); - // Use xattr::get which returns Option> match xattr::get(&full_path, &xattr_name) { Ok(Some(data)) => Ok(data), Ok(None) => Err(SmbError::NotFound), @@ -455,12 +456,12 @@ impl ShareBackend for LocalFsBackend { } let rel = to_rel_path(path); - let root = Arc::clone(&self.root); + let root_path = self.root_path.clone(); let xattr_name = name.to_string(); let value = value.to_vec(); spawn_blocking(move || { - let full_path = (*root).as_std_path().join(&rel); + let full_path = root_path.join(&rel); xattr::set(&full_path, &xattr_name, &value) .map_err(|e| SmbError::Io(e.into())) }) @@ -474,11 +475,11 @@ impl ShareBackend for LocalFsBackend { } let rel = to_rel_path(path); - let root = Arc::clone(&self.root); + let root_path = self.root_path.clone(); let xattr_name = name.to_string(); spawn_blocking(move || { - let full_path = (*root).as_std_path().join(&rel); + let full_path = root_path.join(&rel); xattr::remove(&full_path, &xattr_name) .map_err(|e| SmbError::Io(e.into())) }) @@ -488,12 +489,11 @@ impl ShareBackend for LocalFsBackend { async fn list_xattrs(&self, path: &SmbPath) -> SmbResult> { let rel = to_rel_path(path); - let root = Arc::clone(&self.root); + let root_path = self.root_path.clone(); spawn_blocking(move || { - let full_path = (*root).as_std_path().join(&rel); + let full_path = root_path.join(&rel); - // xattr::list returns iterator of OsString let attrs: Vec = xattr::list(&full_path) .map_err(|e| SmbError::Io(e.into()))? .into_iter()