mirror of
https://github.com/rustfs/rustfs.git
synced 2026-10-27 06:18:43 +00:00
b40f1e5fab
* fix(utils): NUL-terminate and extend paths passed to Win32 volume APIs `get_volume_name` returned the volume root truncated at its NUL and the result was then passed to `GetVolumeInformationW` as a PCWSTR, an out-of-bounds read. The disk-space and volume APIs also received the caller's raw path, so they failed beyond MAX_PATH, and a UNC share root lacked the trailing backslash these APIs require. - Wrap every Win32 path in a NUL-terminated `WidePath` that rejects interior NULs; volume roots returned by `GetVolumePathNameW` keep their terminator. - Convert inputs to the extended-length `\\?\` / `\\?\UNC\` form after `GetFullPathNameW` normalization, and give directory queries a trailing backslash. - Query `GetDiskFreeSpaceW` and `GetVolumeInformationW` on the volume root as documented; size buffers to the documented MAX_PATH + 1 or the input length. - Report Win32 error codes instead of raw HRESULTs so `ErrorKind` matches `std::fs`. - Keep volume ids in their conventional `C:\` / `\\server\share\` form. Add Windows-only `os::` tests for long directories, UNC share roots and non-empty fstype, and run them in the Windows filesystem workflow. * fix(utils): report Windows network volumes to the fs guard Windows names the server's filesystem (usually NTFS) for SMB shares, so the startup unsupported-filesystem guard, which matches fstype names such as cifs or smb2, never fired for UNC paths or mapped drives. - Add `DiskInfo::remote`. On Windows it is set when the directory handle answers `FileRemoteProtocolInfo` (only network redirectors do, and the handle follows symlinks and junctions to their target) or the volume root's `GetDriveTypeW` is `DRIVE_REMOTE`. Unix keeps it false because the client fstype already names network mounts. - Treat remote volumes as unsupported in the startup guard and label them "<fstype> on network share". - Cover UNC shares, paths beyond MAX_PATH below a share, a directory symlink to a share and a `net use` mapped drive with Windows-only `os::` tests that skip when `\\localhost\<drive>$` is unreachable; the Windows filesystem workflow maps the drive before running them. * chore(deps): replace yanked inout 0.2.3 with 0.2.4 cargo-deny's advisories check rejects the yanked inout 0.2.3 that main's lockfile pins, failing every open PR. Lockfile-only patch bump. * fix(utils): detect network targets from the final NT path On the Windows runner, a directory symlink to \\localhost\C$ was reported as local: FileRemoteProtocolInfo did not identify it, and the volume root of the link is a fixed drive. Also treat a handle whose final NT path (GetFinalPathNameByHandleW with VOLUME_NAME_NT) lies under \Device\Mup\ as remote; the Multiple UNC Provider fronts every UNC and mapped-drive target. The tests now assert the handle probe on its own for local and share paths and report both signals when it disagrees. --------- Co-authored-by: overtrue <anzhengchao@gmail.com>