s3: VFS: Change SMB_VFS_SYMLINK to use const struct smb_filename * instead of const...
[sfrench/samba-autobuild/.git] / source3 / smbd / trans2.c
index 3e1cfa8ca968c9023e57b376fbc98a9cfcca00d2..de6073a973fdbc35197caf5831199727b83f49f2 100644 (file)
@@ -1577,18 +1577,18 @@ static NTSTATUS unix_perms_from_wire( connection_struct *conn,
 ****************************************************************************/
 
 static bool check_msdfs_link(connection_struct *conn,
-                               const char *pathname,
-                               SMB_STRUCT_STAT *psbuf)
+                               struct smb_filename *smb_fname)
 {
        int saved_errno = errno;
        if(lp_host_msdfs() &&
                lp_msdfs_root(SNUM(conn)) &&
-               is_msdfs_link(conn, pathname, psbuf)) {
+               is_msdfs_link(conn, smb_fname)) {
 
                DEBUG(5,("check_msdfs_link: Masquerading msdfs link %s "
                        "as a directory\n",
-                       pathname));
-               psbuf->st_ex_mode = (psbuf->st_ex_mode & 0xFFF) | S_IFDIR;
+                       smb_fname->base_name));
+               smb_fname->st.st_ex_mode =
+                       (smb_fname->st.st_ex_mode & 0xFFF) | S_IFDIR;
                errno = saved_errno;
                return true;
        }
@@ -1729,8 +1729,7 @@ static bool smbd_dirptr_lanman2_mode_fn(TALLOC_CTX *ctx,
                 * directories */
 
                ms_dfs_link = check_msdfs_link(state->conn,
-                                              smb_fname->base_name,
-                                              &smb_fname->st);
+                                              smb_fname);
                if (!ms_dfs_link) {
                        DEBUG(5,("smbd_dirptr_lanman2_mode_fn: "
                                 "Couldn't stat [%s] (%s)\n",
@@ -3905,7 +3904,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
                                return NT_STATUS_INVALID_LEVEL;
                        }
 
-                       rc = SMB_VFS_STATVFS(conn, filename, &svfs);
+                       rc = SMB_VFS_STATVFS(conn, &smb_fname, &svfs);
 
                        if (!rc) {
                                data_len = 56;
@@ -5483,7 +5482,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
                                return NT_STATUS_DOS(ERRDOS, ERRbadlink);
 #endif
                                link_len = SMB_VFS_READLINK(conn,
-                                                      smb_fname->base_name,
+                                                      smb_fname,
                                                       buffer, PATH_MAX);
                                if (link_len == -1) {
                                        return map_nt_error_from_unix(errno);
@@ -6149,8 +6148,7 @@ NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
        DEBUG(10,("hardlink_internals: doing hard link %s -> %s\n",
                  smb_fname_old->base_name, smb_fname_new->base_name));
 
-       if (SMB_VFS_LINK(conn, smb_fname_old->base_name,
-                        smb_fname_new->base_name) != 0) {
+       if (SMB_VFS_LINK(conn, smb_fname_old, smb_fname_new) != 0) {
                status = map_nt_error_from_unix(errno);
                DEBUG(3,("hardlink_internals: Error %s hard link %s -> %s\n",
                         nt_errstr(status), smb_fname_old->base_name,
@@ -6609,10 +6607,9 @@ static NTSTATUS smb_set_file_unix_link(connection_struct *conn,
                                       struct smb_request *req,
                                       const char *pdata,
                                       int total_data,
-                                      const struct smb_filename *smb_fname)
+                                      const struct smb_filename *new_smb_fname)
 {
        char *link_target = NULL;
-       const char *newname = smb_fname->base_name;
        TALLOC_CTX *ctx = talloc_tos();
 
        /* Set a symbolic link. */
@@ -6634,9 +6631,9 @@ static NTSTATUS smb_set_file_unix_link(connection_struct *conn,
        }
 
        DEBUG(10,("smb_set_file_unix_link: SMB_SET_FILE_UNIX_LINK doing symlink %s -> %s\n",
-                       newname, link_target ));
+                       new_smb_fname->base_name, link_target ));
 
-       if (SMB_VFS_SYMLINK(conn,link_target,newname) != 0) {
+       if (SMB_VFS_SYMLINK(conn,link_target,new_smb_fname) != 0) {
                return map_nt_error_from_unix(errno);
        }