From 27dda3179edfcc7795af25ece985a2c639eda685 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 19 Mar 2016 21:04:09 -0700 Subject: [PATCH] s3: smbd: DFS - Remove the last lp_posix_pathnames() from the SMB2/3 code paths. lp_posix_pathnames() is only used in one place in SMB1 DFS processing - in dealing with buggy clients, and not at all in SMB2/3. Note that the removal of lp_posix_pathnames() in the initial detection of path separator is a change in behavior - but the case where an incoming DFS name *doesn't* begin with the correct separator is a client bug, so I'm comfortable with making this change. Signed-off-by: Jeremy Allison --- source3/smbd/msdfs.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 647ac3b..cab6ff3 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -82,9 +82,19 @@ static NTSTATUS parse_dfs_path(connection_struct *conn, eos_ptr = &pathname_local[strlen(pathname_local)]; p = temp = pathname_local; - pdp->posix_path = (lp_posix_pathnames() && *pathname == '/'); + /* + * Non-broken DFS paths *must* start with the + * path separator. For Windows this is always '\\', + * for posix paths this is always '/'. + */ - sepchar = pdp->posix_path ? '/' : '\\'; + if (*pathname == '/') { + pdp->posix_path = true; + sepchar = '/'; + } else { + pdp->posix_path = false; + sepchar = '\\'; + } if (allow_broken_path && (*pathname != sepchar)) { DEBUG(10,("parse_dfs_path: path %s doesn't start with %c\n", @@ -92,6 +102,8 @@ static NTSTATUS parse_dfs_path(connection_struct *conn, /* * Possibly client sent a local path by mistake. * Try and convert to a local path. + * Note that this is an SMB1-only fallback + * to cope with known broken SMB1 clients. */ pdp->hostname = eos_ptr; /* "" */ -- 2.8.0.rc3.226.g39d4020