1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3: smbd: Fix cosmetic bug logging pathnames from Linux kernel clients using SMB1 DFS calls.

The Linux kernel SMB1 client has a bug - it sends
DFS pathnames as:

\\server\share\path

instead of:

\server\share\path

Causing us to mis-parse server,share,remaining_path here
and jump into 'goto local_path' at 'share\path' instead
of 'path'.

This doesn't cause an error as the limits on share names
are similar to those on pathnames.

parse_dfs_path() which we call before filename parsing
copes with this by calling trim_char on the leading '\'
characters before processing.

Do the same here so logging of pathnames looks better.

How did I find this ? Lots and lots of manual
testing with the Linux kernel client to make
sure all the recent changes haven't broken Linux
SMB1/2/3 DFS :-).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15144

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2022-08-05 19:27:33 -07:00
parent 23988f19e7
commit 2818fd6910

View File

@ -310,6 +310,29 @@ static size_t srvstr_get_path_internal(TALLOC_CTX *ctx,
*/
server = dst;
/*
* Cosmetic fix for Linux-only DFS clients.
* The Linux kernel SMB1 client has a bug - it sends
* DFS pathnames as:
*
* \\server\share\path
*
* Causing us to mis-parse server,share,remaining_path here
* and jump into 'goto local_path' at 'share\path' instead
* of 'path'.
*
* This doesn't cause an error as the limits on share names
* are similar to those on pathnames.
*
* parse_dfs_path() which we call before filename parsing
* copes with this by calling trim_char on the leading '\'
* characters before processing.
* Do the same here so logging of pathnames looks better.
*/
if (server[1] == path_sep) {
trim_char(&server[1], path_sep, '\0');
}
/*
* Look to see if we also have /share following.
*/