return smb_fname->stream_name;
}
+/****************************************************************************
+ Returns true if the filename's stream == "::$DATA"
+ ***************************************************************************/
+bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname)
+{
+ if (!is_ntfs_stream_smb_fname(smb_fname)) {
+ return false;
+ }
+
+ return StrCaseCmp(smb_fname->stream_name, "::$DATA") == 0;
+}
+
/****************************************************************************
Reply to an NT create and X call on a pipe
****************************************************************************/
? BATCH_OPLOCK : 0;
}
- status = resolve_dfspath(ctx,
+ status = filename_convert(ctx,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
+ &smb_fname,
&fname);
if (!NT_STATUS_IS_OK(status)) {
goto out;
}
- status = unix_convert(ctx, conn, fname, &smb_fname, 0);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- goto out;
- }
-
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
uint32 perms = 0;
p += 25;
if (fsp->is_directory ||
- can_write_to_file(conn, fsp->fsp_name, &smb_fname->st)) {
+ can_write_to_file(conn, smb_fname)) {
perms = FILE_GENERIC_ALL;
} else {
perms = FILE_GENERIC_READ|FILE_EXECUTE;
goto out;
}
- status = resolve_dfspath(ctx,
+ status = filename_convert(ctx,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
+ &smb_fname,
&fname);
if (!NT_STATUS_IS_OK(status)) {
goto out;
}
- status = unix_convert(ctx, conn, fname, &smb_fname, 0);
- if (!NT_STATUS_IS_OK(status)) {
- reply_nterror(req, status);
- goto out;
- }
-
oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
if (oplock_request) {
oplock_request |= (flags & REQUEST_BATCH_OPLOCK)
uint32 perms = 0;
p += 25;
if (fsp->is_directory ||
- can_write_to_file(conn, fsp->fsp_name, &smb_fname->st)) {
+ can_write_to_file(conn, smb_fname)) {
perms = FILE_GENERIC_ALL;
} else {
perms = FILE_GENERIC_READ|FILE_EXECUTE;
static NTSTATUS copy_internals(TALLOC_CTX *ctx,
connection_struct *conn,
struct smb_request *req,
- const char *oldname_in,
- const char *newname_in,
+ struct smb_filename *smb_fname_src,
+ struct smb_filename *smb_fname_dst,
uint32 attrs)
{
- struct smb_filename *smb_fname_src = NULL;
- struct smb_filename *smb_fname_dst = NULL;
char *oldname = NULL;
char *newname = NULL;
files_struct *fsp1,*fsp2;
goto out;
}
- status = unix_convert(ctx, conn, oldname_in, &smb_fname_src, 0);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
-
- status = check_name(conn, smb_fname_src->base_name);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
-
/* Source must already exist. */
if (!VALID_STAT(smb_fname_src->st)) {
status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
goto out;
}
- status = unix_convert(ctx, conn, newname_in, &smb_fname_dst, 0);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
-
- status = check_name(conn, smb_fname_dst->base_name);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
-
/* Disallow if dst file already exists. */
if (VALID_STAT(smb_fname_dst->st)) {
status = NT_STATUS_OBJECT_NAME_COLLISION;
goto out;
}
- /* Ensure this is within the share. */
- status = check_reduced_name(conn, smb_fname_src->base_name);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
-
DEBUG(10,("copy_internals: doing file copy %s to %s\n",
smb_fname_str_dbg(smb_fname_src),
smb_fname_str_dbg(smb_fname_dst)));
smb_fname_str_dbg(smb_fname_dst)));
}
- TALLOC_FREE(smb_fname_src);
- TALLOC_FREE(smb_fname_dst);
TALLOC_FREE(oldname);
TALLOC_FREE(newname);
void reply_ntrename(struct smb_request *req)
{
connection_struct *conn = req->conn;
+ struct smb_filename *smb_fname_old = NULL;
+ struct smb_filename *smb_fname_new = NULL;
char *oldname = NULL;
char *newname = NULL;
const char *p;
return;
}
- status = resolve_dfspath(ctx, conn,
+ status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
oldname,
+ &smb_fname_old,
&oldname);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
return;
}
- status = resolve_dfspath(ctx, conn,
+ status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
newname,
+ &smb_fname_new,
&newname);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
} else {
status = hardlink_internals(ctx,
conn,
- oldname,
- newname);
+ smb_fname_old,
+ smb_fname_new);
}
break;
case RENAME_FLAG_COPY:
/* No wildcards. */
status = NT_STATUS_OBJECT_PATH_SYNTAX_BAD;
} else {
- status = copy_internals(ctx, conn, req, oldname,
- newname, attrs);
+ status = copy_internals(ctx, conn, req,
+ smb_fname_old,
+ smb_fname_new,
+ attrs);
}
break;
case RENAME_FLAG_MOVE_CLUSTER_INFORMATION: