Fix bug #7339 - MSDFS is non-functional in 3.5.x
authorJeremy Allison <jra@samba.org>
Fri, 9 Apr 2010 03:32:36 +0000 (20:32 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 17 May 2010 07:50:10 +0000 (09:50 +0200)
In the refactoring around filename_convert, the split between the functions
resolve_dfspath() and resolve_dfspath_wcard() was lost, leaving us only with
resolve_dfspath_wcard().

Internally resolve_dfspath_wcard() calls dfs_redirect() only with a
"allow_wcards" flag of true, wheras the old resolve_dfspath() would call with a
value of false. The loss of this case causes dfs_redirect to always masquerade
DFS links as directories, even when they are being queried directly by a trans2
QPATHINFO call. We should only masquerade DFS links as directories when called
from a SMBsearch or trans2 findfirst/findnext - which was the intent of the
"allow_wcards" flag.

This patch adds back an allow_wcards bool parameter to
resolve_dfspath_wcard(). This bool is set from the state of the ucf_flags when
filename_convert() is called.

I will follow this up with a new smbclient-based torture test that will prevent
us from ever regressing our DFS support again.

Jeremy.
(cherry picked from commit 358781559526f962c96c1af88cd104946c507d05)
(cherry picked from commit d614655f918fdbafe4520e9cc4d5de82e15b7d7d)

source3/include/proto.h
source3/smbd/filename.c
source3/smbd/msdfs.c
source3/smbd/trans2.c

index 28b7f7c0e9325a00e8b417fb625904b896d9d293..31d0aa665434e1a8ec277e3ea4f789d182e8d79c 100644 (file)
@@ -6481,6 +6481,7 @@ NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
                                connection_struct *conn,
                                bool dfs_pathnames,
                                const char *name_in,
+                               bool allow_wcards,
                                char **pp_name_out,
                                bool *ppath_contains_wcard);
 NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
index ab79dfd9269c48eac05b545fdc3e4bb103cf4e35..154d34a4c06c41754669dee8cec35c6d21ca04fc 100644 (file)
@@ -1125,6 +1125,7 @@ NTSTATUS filename_convert(TALLOC_CTX *ctx,
                                struct smb_filename **pp_smb_fname)
 {
        NTSTATUS status;
+       bool allow_wcards = (ucf_flags & (UCF_COND_ALLOW_WCARD_LCOMP|UCF_ALWAYS_ALLOW_WCARD_LCOMP));
        char *fname = NULL;
 
        *pp_smb_fname = NULL;
@@ -1132,6 +1133,7 @@ NTSTATUS filename_convert(TALLOC_CTX *ctx,
        status = resolve_dfspath_wcard(ctx, conn,
                                dfs_path,
                                name_in,
+                               allow_wcards,
                                &fname,
                                ppath_contains_wcard);
        if (!NT_STATUS_IS_OK(status)) {
index dcef75e094fdc09966555554a1edf46b80de117f..6dfa88692e2b61eeab31254bf39eef1d27ebef11 100644 (file)
@@ -1738,6 +1738,7 @@ NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
                                connection_struct *conn,
                                bool dfs_pathnames,
                                const char *name_in,
+                               bool allow_wcards,
                                char **pp_name_out,
                                bool *ppath_contains_wcard)
 {
@@ -1748,7 +1749,7 @@ NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
                status = dfs_redirect(ctx,
                                        conn,
                                        name_in,
-                                       True,
+                                       allow_wcards,
                                        pp_name_out,
                                        &path_contains_wcard);
 
index 5620a2fd0d848c75943672db8c566872937527ca..36b2749700dcbfcc4f64870f8e2a65652afe6f17 100644 (file)
@@ -5933,6 +5933,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
        status = resolve_dfspath_wcard(ctx, conn,
                                       req->flags2 & FLAGS2_DFS_PATHNAMES,
                                       newname,
+                                      true,
                                       &newname,
                                       &dest_has_wcard);
        if (!NT_STATUS_IS_OK(status)) {