s3: smbd: Change srvstr_get_path_internal() to always call check_path_syntaxXXX(...
authorJeremy Allison <jra@samba.org>
Thu, 4 Aug 2022 16:52:17 +0000 (09:52 -0700)
committerVolker Lendecke <vl@samba.org>
Fri, 5 Aug 2022 09:24:30 +0000 (09:24 +0000)
commitf24ef117cfa195ef19b8130040555b75f42ae00b
tree05b3d7f4498016b21f24033e5e455cb708b0d78d
parent972dd999b8d67f22434db83492d9ccc2efe06300
s3: smbd: Change srvstr_get_path_internal() to always call check_path_syntaxXXX(), even on DFS pathnames.

The original design decision to just copy a DFS path and let
parse_dfs_path() take care of it was a horrible mistake.

Fix srvstr_get_path_internal() to always return a
/server/share/path (i.e. a path separated with '/', not '\').

This is a more complex change than I like to allow
DFS path procesing in srvstr_get_path_internal() but
needed as clients (including Samba smbclient) have a
rather "fuzzy" idea of what constitutes a valid DFS path.
If we detect the DFS path isn't valid here we have to
fall back to treating it as a local path.

I also need to modify the DFS parsing in
filename_convert_smb1_search_path() to cope with only '/'
separators.

This also means parse_dfs_path() needs changing to
cope.

The changes here are best reviewed by just applying
the fix and looking at the modified functions:

srvstr_get_path_internal()
parse_dfs_path()

For parse_dfs_path() it's mostly removing bad code
and makes parse_dfs_path() much easier to read.

These changes will enable me to remove some ugly mistakes made
adding ucf_flags to extract_snapshot_token(), as
we can now always assume canonicalized paths.

This is a little messy, but has to be done in
one chunk as the change to srvstr_get_path_internal()
depends on the change to parse_dfs_path().

Thanks to Volker for the insight that made this
cleanup possible.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/filename.c
source3/smbd/msdfs.c
source3/smbd/smb2_reply.c