mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s3: smbd: Add new function check_path_syntax_smb2_msdfs() for SMB2 MSDFS paths.
#ifdef'ed out as static and not yet used. We can't just call check_path_syntax() on these as they are of the form hostname\share[\extrapath] (where [\extrapath] is optional). hostname here can be an IPv6 ':' separated address, which check_path_syntax() fails on due to the streamname processing. NB. This also has to cope with out existing (broken) libsmbclient libraries that sometimes set the DFS flag and then send a local pathname. Cope by just calling the normal check_path_syntax() on the whole pathname in that case. 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:
parent
2818fd6910
commit
bcba550228
@ -243,6 +243,44 @@ NTSTATUS check_path_syntax_posix(char *path)
|
||||
return check_path_syntax_internal(path, true);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/****************************************************************************
|
||||
Check the path for an SMB2 DFS path.
|
||||
SMB2 DFS paths look like hostname\share (followed by a possible \extrapath.
|
||||
Path returned from here must look like:
|
||||
hostname/share (followed by a possible /extrapath).
|
||||
****************************************************************************/
|
||||
|
||||
static NTSTATUS check_path_syntax_smb2_msdfs(char *path)
|
||||
{
|
||||
char *share = NULL;
|
||||
char *remaining_path = NULL;
|
||||
/* No SMB2 names can start with '\\' */
|
||||
if (path[0] == '\\') {
|
||||
return NT_STATUS_OBJECT_NAME_INVALID;
|
||||
}
|
||||
/*
|
||||
* smbclient libraries sometimes set the DFS flag and send
|
||||
* local pathnames. Cope with this by just calling
|
||||
* check_path_syntax() on the whole path if it doesn't
|
||||
* look like a DFS path, similar to what parse_dfs_path() does.
|
||||
*/
|
||||
/* servername should be at path[0] */
|
||||
share = strchr(path, '\\');
|
||||
if (share == NULL) {
|
||||
return check_path_syntax(path);
|
||||
}
|
||||
*share++ = '/';
|
||||
remaining_path = strchr(share, '\\');
|
||||
if (remaining_path == NULL) {
|
||||
/* Only hostname\share. We're done. */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
*remaining_path++ = '/';
|
||||
return check_path_syntax(remaining_path);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
Pull a string and check the path allowing a wildcard - provide for error return.
|
||||
Passes in posix flag.
|
||||
|
Loading…
Reference in New Issue
Block a user