Re: [PATCH] smb: client: convert path_consumed to mount charset units
From: Paulo Alcantara
Date: Tue Nov 17 2026 - 10:11:27 EST
Fredric Cover <fredric.cover.lkernel@xxxxxxxxx> writes:
> path_consumed in a DFS referral counts bytes of the canonical path,
> which is in the DFS cache charset (utf8). dfs_parse_target_referral()
> applies it as an offset into full_path, which is in the mount charset.
> When the mount charset is not utf8, each non-ASCII character in the
> consumed part that encodes longer in utf8 than in the mount charset
> makes the offset too large, so leading characters of the prefix path
> are dropped. For example, with iocharset=iso8859-1, mounting
> //srv/dfs/café é/sub yields the prefix "ub" instead of "sub" and the
> mount fails with -ENOENT. (A single accented character only worked
> because the offset happened to land after the delimiter.)
>
> Translate the count in parse_dfs_target(), where both strings are
> available, by matching path components: count the delimiters in the
> consumed part of the canonical path and find the same position in the
> mount charset path. Delimiters are ASCII in both and are not affected
> by remapping. If the consumed bytes are identical in both strings,
> which is the case for utf8 mounts and ASCII-only prefixes using the
> default backslash delimiter, the value is used unchanged.
> ...
Applied.