Fix macOS SMB mount: AAPL caps, credit grant, file_index, QueryDirectory padding
- AAPL: Restore UNIX_BASED+NFS_ACE server_caps, RESOLVE_ID+FULL_SYNC volume_caps (Samba baseline) - Credit: Grant min 1 credit in dispatch response for smbclient compatibility - file_index: Assign 1-based index per entry in list_dir (both VFS and local backends) - smb_match(): Add wildcard pattern filter (*/?) for macOS single-entry QueryDirectory probes - FILE_ID_BOTH_DIR_INFORMATION: Add 2-byte Reserved2 padding between ShortName and FileId - macOS Sequoia 15.5 mount_smbfs now succeeds (tested: ls, cat, read)
This commit is contained in:
14
vendor/smb-server/src/fs/local.rs
vendored
14
vendor/smb-server/src/fs/local.rs
vendored
@@ -694,7 +694,7 @@ impl Handle for LocalHandle {
|
||||
LocalHandle::Dir { dir_handle, .. } => {
|
||||
let dir_handle = Arc::clone(dir_handle);
|
||||
let pat = pattern.map(|s| s.to_owned());
|
||||
spawn_blocking(move || -> io::Result<Vec<SmbDirEntry>> {
|
||||
let result: SmbResult<Vec<SmbDirEntry>> = spawn_blocking(move || -> io::Result<Vec<SmbDirEntry>> {
|
||||
let mut out = Vec::new();
|
||||
for entry in dir_handle.entries()? {
|
||||
let entry = entry?;
|
||||
@@ -703,22 +703,26 @@ impl Handle for LocalHandle {
|
||||
continue;
|
||||
};
|
||||
if let Some(p) = pat.as_deref() {
|
||||
if !(p.is_empty() || p == "*" || p == "*.*" || glob_match(p, &name)) {
|
||||
let matches_glob = p.is_empty() || p == "*" || p == "*.*" || glob_match(p, &name);
|
||||
if !matches_glob {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let md = entry.metadata()?;
|
||||
let info = file_info_from_metadata(name, &md);
|
||||
tracing::debug!(name = %info.name, is_dir = %info.is_directory, "list_dir entry");
|
||||
out.push(SmbDirEntry { info });
|
||||
}
|
||||
tracing::debug!(count = %out.len(), "list_dir complete");
|
||||
// Assign unique file_index (1-based) so SMB2 FileId differs per entry
|
||||
for (i, entry) in out.iter_mut().enumerate() {
|
||||
entry.info.file_index = (i + 1) as u64;
|
||||
}
|
||||
Ok(out)
|
||||
})
|
||||
.await
|
||||
.map_err(join_to_io)
|
||||
.map_err(io_to_smb)?
|
||||
.map_err(io_to_smb)
|
||||
.map_err(io_to_smb);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user