Remove reply_unixerror() - no longer needed. Should make Metze's refactoring a lot...
[samba.git] / source3 / smbd / trans2.c
index cb4f10fa79a348c545981fe3ab468e8471d4bc86..6a18f0f710260b3bdcd2642aa0497c2bba70829f 100644 (file)
@@ -964,7 +964,7 @@ static void call_trans2open(connection_struct *conn,
                                req->flags2 & FLAGS2_DFS_PATHNAMES,
                                fname,
                                &smb_fname,
-                               &fname);
+                               NULL);
        if (!NT_STATUS_IS_OK(status)) {
                if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
                        reply_botherror(req,
@@ -981,7 +981,8 @@ static void call_trans2open(connection_struct *conn,
                goto out;
        }
 
-       if (!map_open_params_to_ntcreate(fname, deny_mode, open_ofun,
+       if (!map_open_params_to_ntcreate(smb_fname->base_name, deny_mode,
+                               open_ofun,
                                &access_mask,
                                &share_mode,
                                &create_disposition,
@@ -1047,7 +1048,7 @@ static void call_trans2open(connection_struct *conn,
        }
 
        size = get_file_size_stat(&smb_fname->st);
-       fattr = dos_mode(conn, fsp->fsp_name, &smb_fname->st);
+       fattr = dos_mode(conn, smb_fname);
        mtime = convert_timespec_to_time_t(smb_fname->st.st_ex_mtime);
        inode = smb_fname->st.st_ex_ino;
        if (fattr & aDIR) {
@@ -1388,6 +1389,8 @@ static bool get_lanman2_dir_entry(TALLOC_CTX *ctx,
 
                if (got_match) {
                        bool isdots = (ISDOT(dname) || ISDOTDOT(dname));
+                       struct smb_filename *smb_fname = NULL;
+                       NTSTATUS status;
 
                        if (dont_descend && !isdots) {
                                TALLOC_FREE(fname);
@@ -1412,25 +1415,41 @@ static bool get_lanman2_dir_entry(TALLOC_CTX *ctx,
                                return False;
                        }
 
+                       /* A dirent from dptr_ReadDirName isn't a stream. */
+                       status = create_synthetic_smb_fname(ctx, pathreal,
+                                                           NULL, &sbuf,
+                                                           &smb_fname);
+                       if (!NT_STATUS_IS_OK(status)) {
+                               TALLOC_FREE(fname);
+                               return false;
+                       }
+
                        if (INFO_LEVEL_IS_UNIX(info_level)) {
-                               if (vfs_lstat_smb_fname(conn, pathreal,
-                                                       &sbuf) != 0) {
-                                       DEBUG(5,("get_lanman2_dir_entry:Couldn't lstat [%s] (%s)\n",
-                                               pathreal,strerror(errno)));
+                               if (SMB_VFS_LSTAT(conn, smb_fname) != 0) {
+                                       DEBUG(5,("get_lanman2_dir_entry: "
+                                                "Couldn't lstat [%s] (%s)\n",
+                                                smb_fname_str_dbg(smb_fname),
+                                                strerror(errno)));
+                                       TALLOC_FREE(smb_fname);
                                        TALLOC_FREE(pathreal);
                                        TALLOC_FREE(fname);
                                        continue;
                                }
-                       } else if (!VALID_STAT(sbuf) &&
-                                  vfs_stat_smb_fname(conn, pathreal,
-                                                     &sbuf) != 0) {
+                       } else if (!VALID_STAT(smb_fname->st) &&
+                                  SMB_VFS_STAT(conn, smb_fname) != 0) {
                                /* Needed to show the msdfs symlinks as
                                 * directories */
 
-                               ms_dfs_link = check_msdfs_link(conn, pathreal, &sbuf);
+                               ms_dfs_link =
+                                   check_msdfs_link(conn,
+                                                    smb_fname->base_name,
+                                                    &smb_fname->st);
                                if (!ms_dfs_link) {
-                                       DEBUG(5,("get_lanman2_dir_entry:Couldn't stat [%s] (%s)\n",
-                                               pathreal,strerror(errno)));
+                                       DEBUG(5,("get_lanman2_dir_entry: "
+                                                "Couldn't stat [%s] (%s)\n",
+                                                smb_fname_str_dbg(smb_fname),
+                                                strerror(errno)));
+                                       TALLOC_FREE(smb_fname);
                                        TALLOC_FREE(pathreal);
                                        TALLOC_FREE(fname);
                                        continue;
@@ -1438,38 +1457,42 @@ static bool get_lanman2_dir_entry(TALLOC_CTX *ctx,
                        }
 
                        if (ms_dfs_link) {
-                               mode = dos_mode_msdfs(conn,pathreal,&sbuf);
+                               mode = dos_mode_msdfs(conn, smb_fname);
                        } else {
-                               mode = dos_mode(conn,pathreal,&sbuf);
+                               mode = dos_mode(conn, smb_fname);
                        }
 
                        if (!dir_check_ftype(conn,mode,dirtype)) {
                                DEBUG(5,("get_lanman2_dir_entry: [%s] attribs didn't match %x\n",fname,dirtype));
+                               TALLOC_FREE(smb_fname);
                                TALLOC_FREE(pathreal);
                                TALLOC_FREE(fname);
                                continue;
                        }
 
                        if (!(mode & aDIR)) {
-                               file_size = get_file_size_stat(&sbuf);
+                               file_size = get_file_size_stat(&smb_fname->st);
                        }
-                       allocation_size = SMB_VFS_GET_ALLOC_SIZE(conn,NULL,&sbuf);
+                       allocation_size =
+                           SMB_VFS_GET_ALLOC_SIZE(conn, NULL, &smb_fname->st);
 
                        if (ask_sharemode) {
                                struct timespec write_time_ts;
                                struct file_id fileid;
 
                                ZERO_STRUCT(write_time_ts);
-                               fileid = vfs_file_id_from_sbuf(conn, &sbuf);
+                               fileid = vfs_file_id_from_sbuf(conn,
+                                                              &smb_fname->st);
                                get_file_infos(fileid, NULL, &write_time_ts);
                                if (!null_timespec(write_time_ts)) {
-                                       update_stat_ex_writetime(&sbuf, write_time_ts);
+                                       update_stat_ex_mtime(&smb_fname->st,
+                                                            write_time_ts);
                                }
                        }
 
-                       mdate_ts = sbuf.st_ex_mtime;
-                       adate_ts = sbuf.st_ex_atime;
-                       create_date_ts = sbuf.st_ex_btime;
+                       mdate_ts = smb_fname->st.st_ex_mtime;
+                       adate_ts = smb_fname->st.st_ex_atime;
+                       create_date_ts = smb_fname->st.st_ex_btime;
 
                        if (lp_dos_filetime_resolution(SNUM(conn))) {
                                dos_filetime_timespec(&create_date_ts);
@@ -1482,11 +1505,14 @@ static bool get_lanman2_dir_entry(TALLOC_CTX *ctx,
                        adate = convert_timespec_to_time_t(adate_ts);
 
                        DEBUG(5,("get_lanman2_dir_entry: found %s fname=%s\n",
-                               pathreal,fname));
+                                smb_fname_str_dbg(smb_fname), fname));
 
                        found = True;
 
                        dptr_DirCacheAdd(conn->dirptr, dname, curr_dirpos);
+                       sbuf = smb_fname->st;
+
+                       TALLOC_FREE(smb_fname);
                }
 
                if (!found)
@@ -2671,7 +2697,7 @@ static void call_trans2qfsinfo(connection_struct *conn,
                        uint64_t dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
                        data_len = 18;
                        if (get_dfree_info(conn,".",False,&bsize,&dfree,&dsize) == (uint64_t)-1) {
-                               reply_unixerror(req, ERRHRD, ERRgeneral);
+                               reply_nterror(req, map_nt_error_from_unix(errno));
                                return;
                        }
 
@@ -2792,7 +2818,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_ex_dev, (u
                        uint64_t dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
                        data_len = 24;
                        if (get_dfree_info(conn,".",False,&bsize,&dfree,&dsize) == (uint64_t)-1) {
-                               reply_unixerror(req, ERRHRD, ERRgeneral);
+                               reply_nterror(req, map_nt_error_from_unix(errno));
                                return;
                        }
                        block_size = lp_block_size(snum);
@@ -2825,7 +2851,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
                        uint64_t dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
                        data_len = 32;
                        if (get_dfree_info(conn,".",False,&bsize,&dfree,&dsize) == (uint64_t)-1) {
-                               reply_unixerror(req, ERRHRD, ERRgeneral);
+                               reply_nterror(req, map_nt_error_from_unix(errno));
                                return;
                        }
                        block_size = lp_block_size(snum);
@@ -3966,7 +3992,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                                                 "(%s)\n",
                                                 smb_fname_str_dbg(smb_fname),
                                                 strerror(errno)));
-                                       reply_unixerror(req,ERRDOS,ERRbadpath);
+                                       reply_nterror(req,map_nt_error_from_unix(errno));
                                        return;
                                }
                        } else if (SMB_VFS_STAT(conn, smb_fname)) {
@@ -3974,7 +4000,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                                         "SMB_VFS_STAT of %s failed (%s)\n",
                                         smb_fname_str_dbg(smb_fname),
                                         strerror(errno)));
-                               reply_unixerror(req, ERRDOS, ERRbadpath);
+                               reply_nterror(req, map_nt_error_from_unix(errno));
                                return;
                        }
 
@@ -3991,7 +4017,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                        if (SMB_VFS_FSTAT(fsp, &smb_fname->st) != 0) {
                                DEBUG(3, ("fstat of fnum %d failed (%s)\n",
                                          fsp->fnum, strerror(errno)));
-                               reply_unixerror(req, ERRDOS, ERRbadfid);
+                               reply_nterror(req, map_nt_error_from_unix(errno));
                                return;
                        }
                        pos = fsp->fh->position_information;
@@ -4064,8 +4090,8 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                                                 "(%s)\n",
                                                 smb_fname_str_dbg(smb_fname_base),
                                                 strerror(errno)));
+                                       reply_nterror(req,map_nt_error_from_unix(errno));
                                        TALLOC_FREE(smb_fname_base);
-                                       reply_unixerror(req,ERRDOS,ERRbadpath);
                                        return;
                                }
                        } else {
@@ -4075,8 +4101,8 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                                                 "(%s)\n",
                                                 smb_fname_str_dbg(smb_fname_base),
                                                 strerror(errno)));
+                                       reply_nterror(req,map_nt_error_from_unix(errno));
                                        TALLOC_FREE(smb_fname_base);
-                                       reply_unixerror(req,ERRDOS,ERRbadpath);
                                        return;
                                }
                        }
@@ -4098,7 +4124,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                                         "SMB_VFS_LSTAT of %s failed (%s)\n",
                                         smb_fname_str_dbg(smb_fname),
                                         strerror(errno)));
-                               reply_unixerror(req, ERRDOS, ERRbadpath);
+                               reply_nterror(req,map_nt_error_from_unix(errno));
                                return;
                        }
 
@@ -4113,7 +4139,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                                         "SMB_VFS_STAT of %s failed (%s)\n",
                                         smb_fname_str_dbg(smb_fname),
                                         strerror(errno)));
-                               reply_unixerror(req, ERRDOS, ERRbadpath);
+                               reply_nterror(req,map_nt_error_from_unix(errno));
                                return;
                        }
                }
@@ -4137,16 +4163,16 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
        DEBUG(3,("call_trans2qfilepathinfo %s (fnum = %d) level=%d call=%d total_data=%d\n",
                fname,fsp ? fsp->fnum : -1, info_level,tran_call,total_data));
 
-       p = strrchr_m(fname,'/');
+       p = strrchr_m(smb_fname->base_name,'/');
        if (!p)
-               base_name = fname;
+               base_name = smb_fname->base_name;
        else
                base_name = p+1;
 
        if (ms_dfs_link) {
-               mode = dos_mode_msdfs(conn,fname,&sbuf);
+               mode = dos_mode_msdfs(conn, smb_fname);
        } else {
-               mode = dos_mode(conn,fname,&sbuf);
+               mode = dos_mode(conn, smb_fname);
        }
        if (!mode)
                mode = FILE_ATTRIBUTE_NORMAL;
@@ -4258,7 +4284,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
        }
 
        if (!null_timespec(write_time_ts) && !INFO_LEVEL_IS_UNIX(info_level)) {
-               update_stat_ex_writetime(&sbuf, write_time_ts);
+               update_stat_ex_mtime(&sbuf, write_time_ts);
        }
 
        create_time_ts = sbuf.st_ex_btime;
@@ -4674,19 +4700,18 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
                                DEBUG(10,("call_trans2qfilepathinfo: SMB_QUERY_FILE_UNIX_LINK\n"));
 #ifdef S_ISLNK
                                if(!S_ISLNK(sbuf.st_ex_mode)) {
-                                       reply_unixerror(req, ERRSRV,
+                                       reply_doserror(req, ERRSRV,
                                                        ERRbadlink);
                                        return;
                                }
 #else
-                               reply_unixerror(req, ERRDOS, ERRbadlink);
+                               reply_doserror(req, ERRDOS, ERRbadlink);
                                return;
 #endif
                                len = SMB_VFS_READLINK(conn,fullpathname,
                                                buffer, PATH_MAX);
                                if (len == -1) {
-                                       reply_unixerror(req, ERRDOS,
-                                                       ERRnoaccess);
+                                       reply_nterror(req, map_nt_error_from_unix(errno));
                                        return;
                                }
                                buffer[len] = 0;
@@ -5072,9 +5097,7 @@ static NTSTATUS smb_set_file_dosmode(connection_struct *conn,
        DEBUG(6,("smb_set_file_dosmode: dosmode: 0x%x\n", (unsigned int)dosmode));
 
        /* check the mode isn't different, before changing it */
-       if ((dosmode != 0) && (dosmode != dos_mode(conn,
-                                                  smb_fname_base->base_name,
-                                                  &smb_fname_base->st))) {
+       if ((dosmode != 0) && (dosmode != dos_mode(conn, smb_fname_base))) {
                DEBUG(10,("smb_set_file_dosmode: file %s : setting dos mode "
                          "0x%x\n", smb_fname_str_dbg(smb_fname_base),
                          (unsigned int)dosmode));
@@ -5226,8 +5249,7 @@ static NTSTATUS smb_set_file_disposition_info(connection_struct *conn,
                                const char *pdata,
                                int total_data,
                                files_struct *fsp,
-                               const char *fname,
-                               SMB_STRUCT_STAT *psbuf)
+                               const struct smb_filename *smb_fname)
 {
        NTSTATUS status = NT_STATUS_OK;
        bool delete_on_close;
@@ -5242,11 +5264,11 @@ static NTSTATUS smb_set_file_disposition_info(connection_struct *conn,
        }
 
        delete_on_close = (CVAL(pdata,0) ? True : False);
-       dosmode = dos_mode(conn, fname, psbuf);
+       dosmode = dos_mode(conn, smb_fname);
 
        DEBUG(10,("smb_set_file_disposition_info: file %s, dosmode = %u, "
                "delete_on_close = %u\n",
-               fsp->fsp_name,
+               smb_fname_str_dbg(smb_fname),
                (unsigned int)dosmode,
                (unsigned int)delete_on_close ));
 
@@ -5532,7 +5554,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
                }
        } else {
                /* newname must *not* be a stream name. */
-               if (is_ntfs_stream_name(newname)) {
+               if (newname[0] == ':') {
                        return NT_STATUS_NOT_SUPPORTED;
                }
 
@@ -5890,15 +5912,13 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
                                        const char *pdata,
                                        int total_data,
                                        files_struct *fsp,
-                                       const char *fname,
-                                       SMB_STRUCT_STAT *psbuf)
+                                       struct smb_filename *smb_fname)
 {
-       struct smb_filename *smb_fname = NULL;
        uint64_t allocation_size = 0;
        NTSTATUS status = NT_STATUS_OK;
        files_struct *new_fsp = NULL;
 
-       if (!VALID_STAT(*psbuf)) {
+       if (!VALID_STAT(smb_fname->st)) {
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
        }
 
@@ -5916,20 +5936,22 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
        }
 #endif /* LARGE_SMB_OFF_T */
 
-       DEBUG(10,("smb_set_file_allocation_info: Set file allocation info for file %s to %.0f\n",
-                       fname, (double)allocation_size ));
+       DEBUG(10,("smb_set_file_allocation_info: Set file allocation info for "
+                 "file %s to %.0f\n", smb_fname_str_dbg(smb_fname),
+                 (double)allocation_size));
 
        if (allocation_size) {
                allocation_size = smb_roundup(conn, allocation_size);
        }
 
-       DEBUG(10,("smb_set_file_allocation_info: file %s : setting new allocation size to %.0f\n",
-                       fname, (double)allocation_size ));
+       DEBUG(10,("smb_set_file_allocation_info: file %s : setting new "
+                 "allocation size to %.0f\n", smb_fname_str_dbg(smb_fname),
+                 (double)allocation_size));
 
        if (fsp && fsp->fh->fd != -1) {
                /* Open file handle. */
                /* Only change if needed. */
-               if (allocation_size != get_file_size_stat(psbuf)) {
+               if (allocation_size != get_file_size_stat(&smb_fname->st)) {
                        if (vfs_allocate_file_space(fsp, allocation_size) == -1) {
                                return map_nt_error_from_unix(errno);
                        }
@@ -5944,14 +5966,7 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
        }
 
        /* Pathname or stat or directory file. */
-
-       status = create_synthetic_smb_fname_split(talloc_tos(), fname, psbuf,
-                                                 &smb_fname);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
-        status = SMB_VFS_CREATE_FILE(
+       status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
                0,                                      /* root_dir_fid */
@@ -5969,16 +5984,13 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
                &new_fsp,                               /* result */
                NULL);                                  /* pinfo */
 
-       *psbuf = smb_fname->st;
-       TALLOC_FREE(smb_fname);
-
        if (!NT_STATUS_IS_OK(status)) {
                /* NB. We check for open_was_deferred in the caller. */
                return status;
        }
 
        /* Only change if needed. */
-       if (allocation_size != get_file_size_stat(psbuf)) {
+       if (allocation_size != get_file_size_stat(&smb_fname->st)) {
                if (vfs_allocate_file_space(new_fsp, allocation_size) == -1) {
                        status = map_nt_error_from_unix(errno);
                        close_file(req, new_fsp, NORMAL_CLOSE);
@@ -6748,10 +6760,8 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
                                 struct smb_request *req,
                                const char *pdata,
                                int total_data,
-                               const char *fname,
-                               SMB_STRUCT_STAT *psbuf)
+                               struct smb_filename *smb_fname)
 {
-       struct smb_filename *smb_fname = NULL;
        NTSTATUS status = NT_STATUS_OK;
        files_struct *fsp = NULL;
        uint16 flags = 0;
@@ -6767,29 +6777,23 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
 
        flags = SVAL(pdata,0);
 
-       if (!VALID_STAT(*psbuf)) {
+       if (!VALID_STAT(smb_fname->st)) {
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
        }
 
        if ((flags == SMB_POSIX_UNLINK_DIRECTORY_TARGET) &&
-                       !VALID_STAT_OF_DIR(*psbuf)) {
+                       !VALID_STAT_OF_DIR(smb_fname->st)) {
                return NT_STATUS_NOT_A_DIRECTORY;
        }
 
        DEBUG(10,("smb_posix_unlink: %s %s\n",
                (flags == SMB_POSIX_UNLINK_DIRECTORY_TARGET) ? "directory" : "file",
-               fname));
+               smb_fname_str_dbg(smb_fname)));
 
-       if (VALID_STAT_OF_DIR(*psbuf)) {
+       if (VALID_STAT_OF_DIR(smb_fname->st)) {
                create_options |= FILE_DIRECTORY_FILE;
        }
 
-       status = create_synthetic_smb_fname_split(talloc_tos(), fname, psbuf,
-                                                 &smb_fname);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
         status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
@@ -6808,9 +6812,6 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
                &fsp,                                   /* result */
                &info);                                 /* pinfo */
 
-       *psbuf = smb_fname->st;
-       TALLOC_FREE(smb_fname);
-
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -6854,8 +6855,7 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
                                                &del,
                                                1,
                                                fsp,
-                                               fname,
-                                               psbuf);
+                                               smb_fname);
 
        if (!NT_STATUS_IS_OK(status)) {
                close_file(req, fsp, NORMAL_CLOSE);
@@ -6933,7 +6933,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                                                 "(%s)\n",
                                                 smb_fname_str_dbg(smb_fname),
                                                 strerror(errno)));
-                                       reply_unixerror(req,ERRDOS,ERRbadpath);
+                                       reply_nterror(req, map_nt_error_from_unix(errno));
                                        return;
                                }
                        } else {
@@ -6942,7 +6942,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                                                 "fileinfo of %s failed (%s)\n",
                                                 smb_fname_str_dbg(smb_fname),
                                                 strerror(errno)));
-                                       reply_unixerror(req,ERRDOS,ERRbadpath);
+                                       reply_nterror(req, map_nt_error_from_unix(errno));
                                        return;
                                }
                        }
@@ -6961,7 +6961,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                                                    max_data_bytes);
                                return;
                        } else {
-                               reply_unixerror(req, ERRDOS, ERRbadpath);
+                               reply_doserror(req, ERRDOS, ERRbadpath);
                                return;
                        }
                } else {
@@ -6976,7 +6976,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                                DEBUG(3,("call_trans2setfilepathinfo: fstat "
                                         "of fnum %d failed (%s)\n", fsp->fnum,
                                         strerror(errno)));
-                               reply_unixerror(req, ERRDOS, ERRbadfid);
+                               reply_nterror(req, map_nt_error_from_unix(errno));
                                return;
                        }
                }
@@ -7026,7 +7026,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                                 "%s failed (%s)\n",
                                 smb_fname_str_dbg(smb_fname),
                                 strerror(errno)));
-                       reply_unixerror(req, ERRDOS, ERRbadpath);
+                       reply_nterror(req, map_nt_error_from_unix(errno));
                        return;
                }
        }
@@ -7101,8 +7101,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                                                                pdata,
                                                                total_data,
                                                                fsp,
-                                                               fname,
-                                                               &sbuf);
+                                                               smb_fname);
                        break;
                }
 
@@ -7133,8 +7132,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                                                pdata,
                                                total_data,
                                                fsp,
-                                               fname,
-                                               &sbuf);
+                                               smb_fname);
                        break;
                }
 
@@ -7270,8 +7268,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                        status = smb_posix_unlink(conn, req,
                                                pdata,
                                                total_data,
-                                               fname,
-                                               &sbuf);
+                                               smb_fname);
                        break;
                }