&mapped_name,
vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
return status;
}
- catia_smb_fname = synthetic_smb_fname(talloc_tos(),
+ status = synthetic_pathref(talloc_tos(),
+ handle->conn->cwd_fsp,
mapped_name,
NULL,
&smb_fname->st,
smb_fname->twrp,
- smb_fname->flags);
- if (catia_smb_fname == NULL) {
+ smb_fname->flags,
+ &catia_smb_fname);
+
+ if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(mapped_name);
- return NT_STATUS_NO_MEMORY;
+ return status;
}
status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, catia_smb_fname,
NTSTATUS status;
unsigned int i, num_streams = 0;
struct stream_struct *streams = NULL;
+ struct smb_filename *pathref = NULL;
if (SMB_VFS_STAT(conn, smb_fname) == 0) {
DEBUG(10, ("'%s' exists\n", smb_fname_str_dbg(smb_fname)));
goto fail;
}
+ if (smb_fname->fsp == NULL) {
+ status = synthetic_pathref(mem_ctx,
+ conn->cwd_fsp,
+ smb_fname->base_name,
+ NULL,
+ NULL,
+ smb_fname->twrp,
+ smb_fname->flags,
+ &pathref);
+ if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+ TALLOC_FREE(pathref);
+ SET_STAT_INVALID(smb_fname->st);
+ return NT_STATUS_OK;
+ }
+ DBG_DEBUG("synthetic_pathref failed: %s\n",
+ nt_errstr(status));
+ goto fail;
+ }
+ } else {
+ pathref = smb_fname;
+ }
+
/* Fall back to a case-insensitive scan of all streams on the file. */
- status = vfs_streaminfo(conn, NULL, smb_fname, mem_ctx,
+ status = vfs_streaminfo(conn, NULL, pathref, mem_ctx,
&num_streams, &streams);
-
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
SET_STAT_INVALID(smb_fname->st);
+ TALLOC_FREE(pathref);
return NT_STATUS_OK;
}
/* Couldn't find the stream. */
if (i == num_streams) {
SET_STAT_INVALID(smb_fname->st);
+ TALLOC_FREE(pathref);
TALLOC_FREE(streams);
return NT_STATUS_OK;
}
}
status = NT_STATUS_OK;
fail:
+ TALLOC_FREE(pathref);
TALLOC_FREE(streams);
return status;
}
int j;
unsigned int i, num_streams = 0;
TALLOC_CTX *frame = talloc_stackframe();
+ const struct smb_filename *pathref = NULL;
NTSTATUS status;
- status = vfs_streaminfo(conn, NULL, smb_fname, talloc_tos(),
+ if (smb_fname->fsp == NULL) {
+ struct smb_filename *tmp = NULL;
+ status = synthetic_pathref(frame,
+ conn->cwd_fsp,
+ smb_fname->base_name,
+ NULL,
+ NULL,
+ smb_fname->twrp,
+ smb_fname->flags,
+ &tmp);
+ if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)
+ || NT_STATUS_EQUAL(status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+ DBG_DEBUG("no streams around\n");
+ TALLOC_FREE(frame);
+ return NT_STATUS_OK;
+ }
+ DBG_DEBUG("synthetic_pathref failed: %s\n",
+ nt_errstr(status));
+ goto fail;
+ }
+ pathref = tmp;
+ } else {
+ pathref = smb_fname;
+ }
+ status = vfs_streaminfo(conn, NULL, pathref, talloc_tos(),
&num_streams, &stream_info);
if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)