Fix bug 7950 - Samba 3.5.x fails BASE-CREATEX_SHAREMODES_DIR smbtorture4 test
authorJeremy Allison <jra@samba.org>
Thu, 24 Feb 2011 02:24:41 +0000 (18:24 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 24 Feb 2011 02:24:41 +0000 (18:24 -0800)
We need to revalidate the pathname once re-constructed from a root fsp.

Jeremy.

source3/include/proto.h
source3/modules/onefs_open.c
source3/smbd/open.c

index c2385c93139da0034ea4c1aabd6fd25080aa37bb..fe4a2c1e37dd8205c380f4c1254cdf13641269f7 100644 (file)
@@ -4890,7 +4890,8 @@ NTSTATUS create_file_default(connection_struct *conn,
 NTSTATUS get_relative_fid_filename(connection_struct *conn,
                                   struct smb_request *req,
                                   uint16_t root_dir_fid,
-                                  struct smb_filename *smb_fname);
+                                  const struct smb_filename *smb_fname,
+                                  struct smb_filename **smb_fname_out);
 
 /* The following definitions come from smbd/oplock.c  */
 
index fb4b89a88e5bc8a6926e24af58c317ffd42b9f04..c9372e57deb41b5f1cdae7406dcf4944b9a1644d 100644 (file)
@@ -2093,11 +2093,13 @@ NTSTATUS onefs_create_file(vfs_handle_struct *handle,
 
        /* Get the file name if root_dir_fid was specified. */
        if (root_dir_fid != 0) {
+               struct smb_filename *smb_fname_out = NULL;
                status = get_relative_fid_filename(conn, req, root_dir_fid,
-                                                  smb_fname);
+                                                  smb_fname, &smb_fname_out);
                if (!NT_STATUS_IS_OK(status)) {
                        goto fail;
                }
+               smb_fname = smb_fname_out;
        }
 
        /* All file access must go through check_name() */
index 2c7764ab14d69904fcf1deaf58000ce9de77423e..56c7d03a2c018993d17b598d13de35e1408fcaca 100644 (file)
@@ -3431,7 +3431,8 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
 NTSTATUS get_relative_fid_filename(connection_struct *conn,
                                   struct smb_request *req,
                                   uint16_t root_dir_fid,
-                                  struct smb_filename *smb_fname)
+                                  const struct smb_filename *smb_fname,
+                                  struct smb_filename **smb_fname_out)
 {
        files_struct *dir_fsp;
        char *parent_fname = NULL;
@@ -3519,16 +3520,23 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn,
                }
        }
 
-       new_base_name = talloc_asprintf(smb_fname, "%s%s", parent_fname,
+       new_base_name = talloc_asprintf(talloc_tos(), "%s%s", parent_fname,
                                        smb_fname->base_name);
        if (new_base_name == NULL) {
                status = NT_STATUS_NO_MEMORY;
                goto out;
        }
 
-       TALLOC_FREE(smb_fname->base_name);
-       smb_fname->base_name = new_base_name;
-       status = NT_STATUS_OK;
+       status = filename_convert(req,
+                               conn,
+                               req->flags2 & FLAGS2_DFS_PATHNAMES,
+                               new_base_name,
+                               0,
+                               NULL,
+                               smb_fname_out);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto out;
+       }
 
  out:
        TALLOC_FREE(parent_fname);
@@ -3579,11 +3587,13 @@ NTSTATUS create_file_default(connection_struct *conn,
         */
 
        if (root_dir_fid != 0) {
+               struct smb_filename *smb_fname_out = NULL;
                status = get_relative_fid_filename(conn, req, root_dir_fid,
-                                                  smb_fname);
+                                                  smb_fname, &smb_fname_out);
                if (!NT_STATUS_IS_OK(status)) {
                        goto fail;
                }
+               smb_fname = smb_fname_out;
        }
 
        /*