Set or delete an extended attribute.
****************************************************************************/
-NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, const char *fname, struct ea_list *ea_list)
+NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
+ const struct smb_filename *smb_fname, struct ea_list *ea_list)
{
+ char *fname = NULL;
+ NTSTATUS status;
+
if (!lp_ea_support(SNUM(conn))) {
return NT_STATUS_EAS_NOT_SUPPORTED;
}
+ status = get_full_smb_filename(talloc_tos(), smb_fname,
+ &fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
for (;ea_list; ea_list = ea_list->next) {
int ret;
fstring unix_ea_name;
fname, (unsigned int)deny_mode, (unsigned int)open_attr,
(unsigned int)open_ofun, open_size));
+ status = filename_convert(ctx,
+ conn,
+ req->flags2 & FLAGS2_DFS_PATHNAMES,
+ fname,
+ &smb_fname,
+ &fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
+ reply_botherror(req,
+ NT_STATUS_PATH_NOT_COVERED,
+ ERRSRV, ERRbadpath);
+ goto out;
+ }
+ reply_nterror(req, status);
+ goto out;
+ }
+
if (open_ofun == 0) {
reply_nterror(req, NT_STATUS_OBJECT_NAME_COLLISION);
goto out;
goto out;
}
- status = unix_convert(ctx, conn, fname, &smb_fname, 0);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- goto out;
- }
-
- status = get_full_smb_filename(ctx, smb_fname, &fname);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- goto out;
- }
-
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
0, /* root_dir_fid */
- fname, /* fname */
- 0, /* create_file_flags */
+ smb_fname, /* fname */
access_mask, /* access_mask */
share_mode, /* share_access */
create_disposition, /* create_disposition*/
NULL, /* sd */
ea_list, /* ea_list */
&fsp, /* result */
- &smb_action, /* pinfo */
- &smb_fname->st); /* psbuf */
+ &smb_action); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->mid)) {
}
if (INFO_LEVEL_IS_UNIX(info_level)) {
- if (SMB_VFS_LSTAT(conn,pathreal,&sbuf) != 0) {
+ if (vfs_lstat_smb_fname(conn, pathreal,
+ &sbuf) != 0) {
DEBUG(5,("get_lanman2_dir_entry:Couldn't lstat [%s] (%s)\n",
pathreal,strerror(errno)));
TALLOC_FREE(pathreal);
TALLOC_FREE(fname);
continue;
}
- } else if (!VALID_STAT(sbuf) && SMB_VFS_STAT(conn,pathreal,&sbuf) != 0) {
+ } else if (!VALID_STAT(sbuf) &&
+ vfs_stat_smb_fname(conn, pathreal,
+ &sbuf) != 0) {
/* Needed to show the msdfs symlinks as
* directories */
DEBUG(3,("call_trans2qfsinfo: level = %d\n", info_level));
- if(SMB_VFS_STAT(conn,".",&st)!=0) {
+ if(vfs_stat_smb_fname(conn,".",&st)!=0) {
DEBUG(2,("call_trans2qfsinfo: stat of . failed (%s)\n", strerror(errno)));
reply_doserror(req, ERRSRV, ERRinvdevice);
return;
char *lock_data = NULL;
bool ms_dfs_link = false;
TALLOC_CTX *ctx = talloc_tos();
+ NTSTATUS status = NT_STATUS_OK;
if (!params) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
- ZERO_STRUCT(sbuf);
ZERO_STRUCT(write_time_ts);
if (tran_call == TRANSACT2_QFILEINFO) {
return;
}
+ status = create_synthetic_smb_fname_split(talloc_tos(), fname,
+ NULL, &smb_fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
+ return;
+ }
+
if(fsp->fake_file_handle) {
/*
* This is actually for the QUOTA_FAKE_FILE --metze
if (INFO_LEVEL_IS_UNIX(info_level)) {
/* Always do lstat for UNIX calls. */
- if (SMB_VFS_LSTAT(conn,fname,&sbuf)) {
- DEBUG(3,("call_trans2qfilepathinfo: SMB_VFS_LSTAT of %s failed (%s)\n",fname,strerror(errno)));
+ if (SMB_VFS_LSTAT(conn, smb_fname)) {
+ DEBUG(3,("call_trans2qfilepathinfo: "
+ "SMB_VFS_LSTAT of %s failed "
+ "(%s)\n",
+ smb_fname_str_dbg(smb_fname),
+ strerror(errno)));
reply_unixerror(req,ERRDOS,ERRbadpath);
return;
}
- } else if (SMB_VFS_STAT(conn,fname,&sbuf)) {
- DEBUG(3,("call_trans2qfilepathinfo: SMB_VFS_STAT of %s failed (%s)\n",fname,strerror(errno)));
+ } else if (SMB_VFS_STAT(conn, smb_fname)) {
+ DEBUG(3,("call_trans2qfilepathinfo: "
+ "SMB_VFS_STAT of %s failed (%s)\n",
+ smb_fname_str_dbg(smb_fname),
+ strerror(errno)));
reply_unixerror(req, ERRDOS, ERRbadpath);
return;
}
- fileid = vfs_file_id_from_sbuf(conn, &sbuf);
+ fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st);
get_file_infos(fileid, &delete_pending, &write_time_ts);
} else {
/*
return;
}
- if (SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
- DEBUG(3,("fstat of fnum %d failed (%s)\n", fsp->fnum, strerror(errno)));
+ 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);
return;
}
pos = fsp->fh->position_information;
- fileid = vfs_file_id_from_sbuf(conn, &sbuf);
+ fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st);
get_file_infos(fileid, &delete_pending, &write_time_ts);
}
} else {
- NTSTATUS status = NT_STATUS_OK;
-
/* qpathinfo */
if (total_params < 7) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
- status = resolve_dfspath(ctx,
+ status = filename_convert(ctx,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
+ &smb_fname,
&fname);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
reply_botherror(req,
NT_STATUS_PATH_NOT_COVERED,
ERRSRV, ERRbadpath);
+ return;
}
reply_nterror(req, status);
return;
}
- status = unix_convert(ctx, conn, fname, &smb_fname, 0);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- return;
- }
- sbuf = smb_fname->st;
-
- status = get_full_smb_filename(ctx, smb_fname, &fname);
- TALLOC_FREE(smb_fname);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- return;
- }
-
- status = check_name(conn, fname);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(3,("call_trans2qfilepathinfo: fileinfo of %s failed (%s)\n",fname,nt_errstr(status)));
- reply_nterror(req, status);
- return;
- }
-
+ /* If this is a stream, check if there is a delete_pending. */
if ((conn->fs_capabilities & FILE_NAMED_STREAMS)
- && is_ntfs_stream_name(fname)) {
- char *base;
- SMB_STRUCT_STAT bsbuf;
-
- status = split_ntfs_stream_name(talloc_tos(), fname,
- &base, NULL);
+ && is_ntfs_stream_smb_fname(smb_fname)) {
+ struct smb_filename *smb_fname_base = NULL;
+
+ /* Create an smb_filename with stream_name == NULL. */
+ status =
+ create_synthetic_smb_fname(talloc_tos(),
+ smb_fname->base_name,
+ NULL, NULL,
+ &smb_fname_base);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(10, ("create_file_unixpath: "
- "split_ntfs_stream_name failed: %s\n",
- nt_errstr(status)));
reply_nterror(req, status);
return;
}
- SMB_ASSERT(!is_ntfs_stream_name(base)); /* paranoia.. */
-
if (INFO_LEVEL_IS_UNIX(info_level)) {
/* Always do lstat for UNIX calls. */
- if (SMB_VFS_LSTAT(conn,base,&bsbuf)) {
- DEBUG(3,("call_trans2qfilepathinfo: SMB_VFS_LSTAT of %s failed (%s)\n",base,strerror(errno)));
+ if (SMB_VFS_LSTAT(conn, smb_fname_base) != 0) {
+ DEBUG(3,("call_trans2qfilepathinfo: "
+ "SMB_VFS_LSTAT of %s failed "
+ "(%s)\n",
+ smb_fname_str_dbg(smb_fname_base),
+ strerror(errno)));
+ TALLOC_FREE(smb_fname_base);
reply_unixerror(req,ERRDOS,ERRbadpath);
return;
}
} else {
- if (SMB_VFS_STAT(conn,base,&bsbuf) != 0) {
- DEBUG(3,("call_trans2qfilepathinfo: fileinfo of %s failed (%s)\n",base,strerror(errno)));
+ if (SMB_VFS_STAT(conn, smb_fname_base) != 0) {
+ DEBUG(3,("call_trans2qfilepathinfo: "
+ "fileinfo of %s failed "
+ "(%s)\n",
+ smb_fname_str_dbg(smb_fname_base),
+ strerror(errno)));
+ TALLOC_FREE(smb_fname_base);
reply_unixerror(req,ERRDOS,ERRbadpath);
return;
}
}
- fileid = vfs_file_id_from_sbuf(conn, &bsbuf);
+ fileid = vfs_file_id_from_sbuf(conn,
+ &smb_fname_base->st);
+ TALLOC_FREE(smb_fname_base);
get_file_infos(fileid, &delete_pending, NULL);
if (delete_pending) {
reply_nterror(req, NT_STATUS_DELETE_PENDING);
if (INFO_LEVEL_IS_UNIX(info_level)) {
/* Always do lstat for UNIX calls. */
- if (SMB_VFS_LSTAT(conn,fname,&sbuf)) {
- DEBUG(3,("call_trans2qfilepathinfo: SMB_VFS_LSTAT of %s failed (%s)\n",fname,strerror(errno)));
+ if (SMB_VFS_LSTAT(conn, smb_fname)) {
+ DEBUG(3,("call_trans2qfilepathinfo: "
+ "SMB_VFS_LSTAT of %s failed (%s)\n",
+ smb_fname_str_dbg(smb_fname),
+ strerror(errno)));
reply_unixerror(req, ERRDOS, ERRbadpath);
return;
}
- } else if (!VALID_STAT(sbuf) && SMB_VFS_STAT(conn,fname,&sbuf) && (info_level != SMB_INFO_IS_NAME_VALID)) {
- ms_dfs_link = check_msdfs_link(conn,fname,&sbuf);
+ } else if (!VALID_STAT(smb_fname->st) &&
+ SMB_VFS_STAT(conn, smb_fname) &&
+ (info_level != SMB_INFO_IS_NAME_VALID)) {
+ ms_dfs_link = check_msdfs_link(conn, fname,
+ &smb_fname->st);
if (!ms_dfs_link) {
- DEBUG(3,("call_trans2qfilepathinfo: SMB_VFS_STAT of %s failed (%s)\n",fname,strerror(errno)));
+ DEBUG(3,("call_trans2qfilepathinfo: "
+ "SMB_VFS_STAT of %s failed (%s)\n",
+ smb_fname_str_dbg(smb_fname),
+ strerror(errno)));
reply_unixerror(req, ERRDOS, ERRbadpath);
return;
}
}
- fileid = vfs_file_id_from_sbuf(conn, &sbuf);
+ fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st);
get_file_infos(fileid, &delete_pending, &write_time_ts);
if (delete_pending) {
reply_nterror(req, NT_STATUS_DELETE_PENDING);
}
}
+ /* Set sbuf for use below. */
+ sbuf = smb_fname->st;
+
if (INFO_LEVEL_IS_UNIX(info_level) && !lp_unix_extensions()) {
reply_nterror(req, NT_STATUS_INVALID_LEVEL);
return;
case SMB_FILE_STREAM_INFORMATION: {
unsigned int num_streams;
struct stream_struct *streams;
- NTSTATUS status;
DEBUG(10,("call_trans2qfilepathinfo: "
"SMB_FILE_STREAM_INFORMATION\n"));
case SMB_QUERY_POSIX_LOCK:
{
- NTSTATUS status = NT_STATUS_INVALID_LEVEL;
uint64_t count;
uint64_t offset;
uint32 lock_pid;
NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
connection_struct *conn,
- const char *oldname_in,
- const char *newname_in)
+ const struct smb_filename *smb_fname_old,
+ const struct smb_filename *smb_fname_new)
{
- struct smb_filename *smb_fname = NULL;
- struct smb_filename *smb_fname_new = NULL;
char *oldname = NULL;
char *newname = NULL;
NTSTATUS status = NT_STATUS_OK;
- status = unix_convert(ctx, conn, oldname_in, &smb_fname, 0);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
-
- status = get_full_smb_filename(ctx, smb_fname, &oldname);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
-
- status = check_name(conn, oldname);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
-
/* source must already exist. */
- if (!VALID_STAT(smb_fname->st)) {
- status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
- goto out;
- }
-
- status = unix_convert(ctx, conn, newname_in, &smb_fname_new, 0);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
-
- status = get_full_smb_filename(ctx, smb_fname_new, &newname);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
-
- status = check_name(conn, newname);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
+ if (!VALID_STAT(smb_fname_old->st)) {
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
/* Disallow if newname already exists. */
if (VALID_STAT(smb_fname_new->st)) {
- status = NT_STATUS_OBJECT_NAME_COLLISION;
- goto out;
+ return NT_STATUS_OBJECT_NAME_COLLISION;
}
/* No links from a directory. */
- if (S_ISDIR(smb_fname->st.st_ex_mode)) {
- status = NT_STATUS_FILE_IS_A_DIRECTORY;
- goto out;
+ if (S_ISDIR(smb_fname_old->st.st_ex_mode)) {
+ return NT_STATUS_FILE_IS_A_DIRECTORY;
}
- /* Ensure this is within the share. */
- status = check_reduced_name(conn, oldname);
+ status = get_full_smb_filename(ctx, smb_fname_new, &newname);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto out;
+ }
+ status = get_full_smb_filename(ctx, smb_fname_old, &oldname);
if (!NT_STATUS_IS_OK(status)) {
goto out;
}
nt_errstr(status), newname, oldname));
}
out:
- TALLOC_FREE(smb_fname);
- TALLOC_FREE(smb_fname_new);
+ TALLOC_FREE(newname);
+ TALLOC_FREE(oldname);
return status;
}
SMB_STRUCT_STAT *psbuf,
SMB_OFF_T size)
{
+ struct smb_filename *smb_fname = NULL;
NTSTATUS status = NT_STATUS_OK;
files_struct *new_fsp = NULL;
return NT_STATUS_OK;
}
+ 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 */
0, /* root_dir_fid */
- fname, /* fname */
- 0, /* create_file_flags */
+ smb_fname, /* fname */
FILE_WRITE_ATTRIBUTES, /* access_mask */
(FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */
FILE_SHARE_DELETE),
NULL, /* sd */
NULL, /* ea_list */
&new_fsp, /* result */
- NULL, /* pinfo */
- psbuf); /* psbuf */
+ 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. */
const char *pdata,
int total_data,
files_struct *fsp,
- const char *fname)
+ const struct smb_filename *smb_fname)
{
struct ea_list *ea_list = NULL;
TALLOC_CTX *ctx = NULL;
if (!ea_list) {
return NT_STATUS_INVALID_PARAMETER;
}
- status = set_ea(conn, fsp, fname, ea_list);
+ status = set_ea(conn, fsp, smb_fname, ea_list);
return status;
}
static NTSTATUS smb_set_file_unix_hlink(connection_struct *conn,
struct smb_request *req,
const char *pdata, int total_data,
- const char *fname)
+ const struct smb_filename *smb_fname_new)
{
char *oldname = NULL;
+ struct smb_filename *smb_fname_old = NULL;
TALLOC_CTX *ctx = talloc_tos();
NTSTATUS status = NT_STATUS_OK;
return status;
}
- status = resolve_dfspath(ctx, conn,
+ DEBUG(10,("smb_set_file_unix_hlink: SMB_SET_FILE_UNIX_LINK doing hard link %s -> %s\n",
+ smb_fname_str_dbg(smb_fname_new), oldname));
+
+ status = filename_convert(ctx,
+ conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
oldname,
+ &smb_fname_old,
&oldname);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- DEBUG(10,("smb_set_file_unix_hlink: SMB_SET_FILE_UNIX_LINK doing hard link %s -> %s\n",
- fname, oldname));
-
- return hardlink_internals(ctx, conn, oldname, fname);
+ return hardlink_internals(ctx, conn, smb_fname_old, smb_fname_new);
}
/****************************************************************************
const char *fname,
SMB_STRUCT_STAT *psbuf)
{
+ struct smb_filename *smb_fname = NULL;
uint64_t allocation_size = 0;
NTSTATUS status = NT_STATUS_OK;
files_struct *new_fsp = NULL;
/* Pathname or stat or directory file. */
- status = SMB_VFS_CREATE_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 */
0, /* root_dir_fid */
- fname, /* fname */
- 0, /* create_file_flags */
+ smb_fname, /* fname */
FILE_WRITE_DATA, /* access_mask */
(FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */
FILE_SHARE_DELETE),
NULL, /* sd */
NULL, /* ea_list */
&new_fsp, /* result */
- NULL, /* pinfo */
- psbuf); /* psbuf */
+ 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. */
TALLOC_FREE(parent);
}
- if (SMB_VFS_STAT(conn, fname, psbuf) != 0) {
+ if (vfs_stat_smb_fname(conn, fname, psbuf) != 0) {
status = map_nt_error_from_unix(errno);
SMB_VFS_UNLINK(conn,fname);
return status;
SMB_STRUCT_STAT *psbuf,
int *pdata_return_size)
{
+ struct smb_filename *smb_fname;
NTSTATUS status = NT_STATUS_OK;
uint32 raw_unixmode = 0;
uint32 mod_unixmode = 0;
DEBUG(10,("smb_posix_mkdir: file %s, mode 0%o\n",
fname, (unsigned int)unixmode ));
- status = SMB_VFS_CREATE_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 */
0, /* root_dir_fid */
- fname, /* fname */
- 0, /* create_file_flags */
+ smb_fname, /* fname */
FILE_READ_ATTRIBUTES, /* access_mask */
FILE_SHARE_NONE, /* share_access */
FILE_CREATE, /* create_disposition*/
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
- &info, /* pinfo */
- psbuf); /* psbuf */
+ &info); /* pinfo */
+
+ *psbuf = smb_fname->st;
+ TALLOC_FREE(smb_fname);
if (NT_STATUS_IS_OK(status)) {
close_file(req, fsp, NORMAL_CLOSE);
SMB_STRUCT_STAT *psbuf,
int *pdata_return_size)
{
+ struct smb_filename *smb_fname = NULL;
bool extended_oplock_granted = False;
char *pdata = *ppdata;
uint32 flags = 0;
(unsigned int)wire_open_mode,
(unsigned int)unixmode ));
+ 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 */
0, /* root_dir_fid */
- fname, /* fname */
- 0, /* create_file_flags */
+ smb_fname, /* fname */
access_mask, /* access_mask */
(FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */
FILE_SHARE_DELETE),
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
- &info, /* pinfo */
- psbuf); /* psbuf */
+ &info); /* pinfo */
+
+ *psbuf = smb_fname->st;
+ TALLOC_FREE(smb_fname);
if (!NT_STATUS_IS_OK(status)) {
return status;
const char *fname,
SMB_STRUCT_STAT *psbuf)
{
+ struct smb_filename *smb_fname = NULL;
NTSTATUS status = NT_STATUS_OK;
files_struct *fsp = NULL;
uint16 flags = 0;
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 */
0, /* root_dir_fid */
- fname, /* fname */
- 0, /* create_file_flags */
+ smb_fname, /* fname */
DELETE_ACCESS, /* access_mask */
(FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */
FILE_SHARE_DELETE),
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
- &info, /* pinfo */
- psbuf); /* psbuf */
+ &info); /* pinfo */
+
+ *psbuf = smb_fname->st;
+ TALLOC_FREE(smb_fname);
if (!NT_STATUS_IS_OK(status)) {
return status;
return;
}
- ZERO_STRUCT(sbuf);
-
if (tran_call == TRANSACT2_SETFILEINFO) {
if (total_params < 4) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
+ status = create_synthetic_smb_fname_split(talloc_tos(), fname,
+ NULL, &smb_fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
+ return;
+ }
+
if(fsp->is_directory || fsp->fh->fd == -1) {
/*
* This is actually a SETFILEINFO on a directory
*/
if (INFO_LEVEL_IS_UNIX(info_level)) {
/* Always do lstat for UNIX calls. */
- if (SMB_VFS_LSTAT(conn,fname,&sbuf)) {
- DEBUG(3,("call_trans2setfilepathinfo: SMB_VFS_LSTAT of %s failed (%s)\n",fname,strerror(errno)));
+ if (SMB_VFS_LSTAT(conn, smb_fname)) {
+ DEBUG(3,("call_trans2setfilepathinfo: "
+ "SMB_VFS_LSTAT of %s failed "
+ "(%s)\n",
+ smb_fname_str_dbg(smb_fname),
+ strerror(errno)));
reply_unixerror(req,ERRDOS,ERRbadpath);
return;
}
} else {
- if (SMB_VFS_STAT(conn,fname,&sbuf) != 0) {
- DEBUG(3,("call_trans2setfilepathinfo: fileinfo of %s failed (%s)\n",fname,strerror(errno)));
+ if (SMB_VFS_STAT(conn, smb_fname) != 0) {
+ DEBUG(3,("call_trans2setfilepathinfo: "
+ "fileinfo of %s failed (%s)\n",
+ smb_fname_str_dbg(smb_fname),
+ strerror(errno)));
reply_unixerror(req,ERRDOS,ERRbadpath);
return;
}
return;
}
- if (SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
- DEBUG(3,("call_trans2setfilepathinfo: fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno)));
+ if (SMB_VFS_FSTAT(fsp, &smb_fname->st) != 0) {
+ DEBUG(3,("call_trans2setfilepathinfo: fstat "
+ "of fnum %d failed (%s)\n", fsp->fnum,
+ strerror(errno)));
reply_unixerror(req, ERRDOS, ERRbadfid);
return;
}
return;
}
- status = resolve_dfspath(ctx, conn,
+ status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
+ &smb_fname,
&fname);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
return;
}
- status = unix_convert(ctx, conn, fname, &smb_fname, 0);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- return;
- }
- sbuf = smb_fname->st;
-
- status = get_full_smb_filename(ctx, smb_fname, &fname);
- TALLOC_FREE(smb_fname);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- return;
- }
-
- status = check_name(conn, fname);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- return;
- }
-
if (INFO_LEVEL_IS_UNIX(info_level)) {
/*
* For CIFS UNIX extensions the target name may not exist.
*/
/* Always do lstat for UNIX calls. */
- SMB_VFS_LSTAT(conn,fname,&sbuf);
-
- } else if (!VALID_STAT(sbuf) && SMB_VFS_STAT(conn,fname,&sbuf)) {
- DEBUG(3,("call_trans2setfilepathinfo: SMB_VFS_STAT of %s failed (%s)\n",fname,strerror(errno)));
+ SMB_VFS_LSTAT(conn, smb_fname);
+
+ } else if (!VALID_STAT(smb_fname->st) &&
+ SMB_VFS_STAT(conn, smb_fname)) {
+ DEBUG(3,("call_trans2setfilepathinfo: SMB_VFS_STAT of "
+ "%s failed (%s)\n",
+ smb_fname_str_dbg(smb_fname),
+ strerror(errno)));
reply_unixerror(req, ERRDOS, ERRbadpath);
return;
}
}
+ /* Set sbuf for use below. */
+ sbuf = smb_fname->st;
+
if (INFO_LEVEL_IS_UNIX(info_level) && !lp_unix_extensions()) {
reply_nterror(req, NT_STATUS_INVALID_LEVEL);
return;
pdata,
total_data,
fsp,
- fname);
+ smb_fname);
break;
}
case SMB_SET_FILE_UNIX_HLINK:
{
- if (tran_call != TRANSACT2_SETPATHINFO) {
+ if (tran_call != TRANSACT2_SETPATHINFO || smb_fname == NULL) {
/* We must have a pathname for this. */
reply_nterror(req, NT_STATUS_INVALID_LEVEL);
return;
}
status = smb_set_file_unix_hlink(conn, req,
pdata, total_data,
- fname);
+ smb_fname);
break;
}
DEBUG(3,("call_trans2mkdir : name = %s\n", directory));
- status = unix_convert(ctx, conn, directory, &smb_dname, 0);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- return;
- }
+ status = filename_convert(ctx,
+ conn,
+ req->flags2 & FLAGS2_DFS_PATHNAMES,
+ directory,
+ &smb_dname,
+ &directory);
- status = check_name(conn, smb_dname->base_name);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(5,("call_trans2mkdir error (%s)\n", nt_errstr(status)));
+ if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
+ reply_botherror(req,
+ NT_STATUS_PATH_NOT_COVERED,
+ ERRSRV, ERRbadpath);
+ return;
+ }
reply_nterror(req, status);
- goto out;
- }
+ return;
+ }
/* Any data in this call is an EA list. */
if (total_data && (total_data != 4) && !lp_ea_support(SNUM(conn))) {
/* Try and set any given EA. */
if (ea_list) {
- status = set_ea(conn, NULL, smb_dname->base_name, ea_list);
+ status = set_ea(conn, NULL, smb_dname, ea_list);
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
goto out;