Prepare for changing vfs_streaminfo to do the same.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Mar 7 21:12:56 CET 2016 on sn-devel-144
static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *num_streams,
struct stream_struct **streams)
static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *num_streams,
struct stream_struct **streams)
{
return SMB_VFS_NEXT_STREAMINFO(handle,
- fsp,
- fname, mem_ctx, num_streams, streams);
+ fsp,
+ smb_fname,
+ mem_ctx,
+ num_streams,
+ streams);
}
static int skel_get_real_filename(struct vfs_handle_struct *handle,
const struct smb_filename * */
/* Version 35 - Change lchown from const char *, to
const struct smb_filename * */
+/* Version 35 - Change streaminfo from const char *, to
+ const struct smb_filename * */
#define SMB_VFS_INTERFACE_VERSION 35
NTSTATUS (*streaminfo_fn)(struct vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *num_streams,
struct stream_struct **streams);
const SMB_STRUCT_STAT *sbuf);
NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *num_streams,
struct stream_struct **streams);
#define SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf) \
smb_vfs_call_file_id_create((handle)->next, (sbuf))
-#define SMB_VFS_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) \
- smb_vfs_call_streaminfo((conn)->vfs_handles, (fsp), (fname), (mem_ctx), (num_streams), (streams))
-#define SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, num_streams, streams) \
- smb_vfs_call_streaminfo((handle)->next, (fsp), (fname), (mem_ctx), (num_streams), (streams))
+#define SMB_VFS_STREAMINFO(conn, fsp, smb_fname, mem_ctx, num_streams, streams) \
+ smb_vfs_call_streaminfo((conn)->vfs_handles, (fsp), (smb_fname), (mem_ctx), (num_streams), (streams))
+#define SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx, num_streams, streams) \
+ smb_vfs_call_streaminfo((handle)->next, (fsp), (smb_fname), (mem_ctx), (num_streams), (streams))
#define SMB_VFS_GET_REAL_FILENAME(conn, path, name, mem_ctx, found_name) \
smb_vfs_call_get_real_filename((conn)->vfs_handles, (path), (name), (mem_ctx), (found_name))
static NTSTATUS
catia_streaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *path,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *_num_streams,
struct stream_struct **_streams)
char *mapped_name = NULL;
NTSTATUS status;
int i;
+ struct smb_filename *catia_smb_fname = NULL;
unsigned int num_streams = 0;
struct stream_struct *streams = NULL;
*_num_streams = 0;
*_streams = NULL;
- status = catia_string_replace_allocate(handle->conn, path,
- &mapped_name, vfs_translate_to_unix);
+ status = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &mapped_name,
+ vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return status;
}
- status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, mapped_name,
+ catia_smb_fname = synthetic_smb_fname(talloc_tos(),
+ mapped_name,
+ NULL,
+ NULL);
+ if (catia_smb_fname == NULL) {
+ TALLOC_FREE(mapped_name);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, catia_smb_fname,
mem_ctx, &num_streams, &streams);
TALLOC_FREE(mapped_name);
+ TALLOC_FREE(catia_smb_fname);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *pnum_streams,
struct stream_struct **pstreams)
ret = SMB_VFS_FSTAT(fsp, &sbuf);
}
else {
- struct smb_filename smb_fname;
+ struct smb_filename smb_fname_cp;
- ZERO_STRUCT(smb_fname);
- smb_fname.base_name = discard_const_p(char, fname);
+ ZERO_STRUCT(smb_fname_cp);
+ smb_fname_cp.base_name = discard_const_p(char,
+ smb_fname->base_name);
if (lp_posix_pathnames()) {
- ret = SMB_VFS_LSTAT(handle->conn, &smb_fname);
+ ret = SMB_VFS_LSTAT(handle->conn, &smb_fname_cp);
} else {
- ret = SMB_VFS_STAT(handle->conn, &smb_fname);
+ ret = SMB_VFS_STAT(handle->conn, &smb_fname_cp);
}
- sbuf = smb_fname.st;
+ sbuf = smb_fname_cp.st;
}
if (ret == -1) {
static NTSTATUS fruit_streaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *pnum_streams,
struct stream_struct **pstreams)
{
struct fruit_config_data *config = NULL;
- struct smb_filename *smb_fname = NULL;
struct adouble *ad = NULL;
NTSTATUS status;
SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data,
return NT_STATUS_UNSUCCESSFUL);
- DEBUG(10, ("fruit_streaminfo called for %s\n", fname));
-
- smb_fname = synthetic_smb_fname(talloc_tos(), fname, NULL, NULL);
- if (smb_fname == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
+ DEBUG(10, ("fruit_streaminfo called for %s\n", smb_fname->base_name));
if (config->meta == FRUIT_META_NETATALK) {
ad = ad_get(talloc_tos(), handle,
smb_roundup(handle->conn,
AFP_INFO_SIZE))) {
TALLOC_FREE(ad);
- TALLOC_FREE(smb_fname);
return NT_STATUS_NO_MEMORY;
}
}
ad_getentrylen(
ad, ADEID_RFORK)))) {
TALLOC_FREE(ad);
- TALLOC_FREE(smb_fname);
return NT_STATUS_NO_MEMORY;
}
}
TALLOC_FREE(ad);
}
- TALLOC_FREE(smb_fname);
-
- status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
+ status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx,
pnum_streams, pstreams);
if (!NT_STATUS_IS_OK(status)) {
return status;
if (!del_fruit_stream(mem_ctx, pnum_streams, pstreams,
":" NETATALK_META_XATTR ":$DATA")) {
TALLOC_FREE(ad);
- TALLOC_FREE(smb_fname);
return NT_STATUS_NO_MEMORY;
}
}
* because streams are few and small.
*/
status = vfs_streaminfo(state->handle->conn, state->src_fsp,
- state->src_fsp->fsp_name->base_name,
+ state->src_fsp->fsp_name,
req, &num_streams, &streams);
if (tevent_req_nterror(req, status)) {
return;
static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *pnum_streams,
struct stream_struct **pstreams)
{
NTSTATUS result;
- result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
+ result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx,
pnum_streams, pstreams);
do_log(SMB_VFS_OP_STREAMINFO, NT_STATUS_IS_OK(result), handle,
- "%s", fname);
+ "%s", smb_fname->base_name);
return result;
}
*/
static NTSTATUS mh_streaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *ctx,
unsigned int *num_streams,
struct stream_struct **streams)
{
NTSTATUS status;
- char *clientPath;
- TALLOC_CTX *mem_ctx;
+ int ret;
+ struct smb_filename *clientFname = NULL;
DEBUG(MH_INFO_DEBUG, ("Entering mh_streaminfo\n"));
- if (!is_in_media_files(fname))
- {
- status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname,
- ctx, num_streams, streams);
+ if (!is_in_media_files(smb_fname->base_name)) {
+ status = SMB_VFS_NEXT_STREAMINFO(handle,
+ fsp,
+ smb_fname,
+ ctx,
+ num_streams,
+ streams);
goto out;
}
- clientPath = NULL;
- mem_ctx = talloc_tos();
-
- if (alloc_get_client_path(handle, mem_ctx,
- fname,
- &clientPath))
- {
- status = map_nt_error_from_unix(errno);
+ ret = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &clientFname);
+ if (ret != 0) {
+ status = NT_STATUS_NO_MEMORY;
goto err;
}
/* This only works on files, so we don't have to worry about
* our fake directory stat'ing here.
*/
- // But what does this function do, exactly? Does it need
- // extra modifications for the Avid stuff?
- status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, clientPath,
+ status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, clientFname,
ctx, num_streams, streams);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return status;
}
static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *pnum_streams,
struct stream_struct **pstreams)
{
- struct smb_filename *smb_fname_base;
+ struct smb_filename *smb_fname_base = NULL;
int ret;
NTSTATUS status;
struct streaminfo_state state;
- smb_fname_base = synthetic_smb_fname(talloc_tos(), fname, NULL, NULL);
+ smb_fname_base = synthetic_smb_fname(talloc_tos(),
+ smb_fname->base_name,
+ NULL,
+ NULL);
if (smb_fname_base == NULL) {
return NT_STATUS_NO_MEMORY;
}
*pnum_streams = state.num_streams;
*pstreams = state.streams;
- status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, pnum_streams, pstreams);
+ status = SMB_VFS_NEXT_STREAMINFO(handle,
+ fsp,
+ smb_fname_base,
+ mem_ctx,
+ pnum_streams,
+ pstreams);
out:
TALLOC_FREE(smb_fname_base);
static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *pnum_streams,
struct stream_struct **pstreams)
ret = SMB_VFS_FSTAT(fsp, &sbuf);
}
else {
- struct smb_filename *smb_fname = NULL;
- smb_fname = synthetic_smb_fname(talloc_tos(), fname, NULL,
- NULL);
- if (smb_fname == NULL) {
+ struct smb_filename *smb_fname_base = NULL;
+ smb_fname_base = synthetic_smb_fname(talloc_tos(),
+ smb_fname->base_name,
+ NULL,
+ NULL);
+ if (smb_fname_base == NULL) {
return NT_STATUS_NO_MEMORY;
}
if (lp_posix_pathnames()) {
- ret = SMB_VFS_LSTAT(handle->conn, smb_fname);
+ ret = SMB_VFS_LSTAT(handle->conn, smb_fname_base);
} else {
- ret = SMB_VFS_STAT(handle->conn, smb_fname);
+ ret = SMB_VFS_STAT(handle->conn, smb_fname_base);
}
- sbuf = smb_fname->st;
- TALLOC_FREE(smb_fname);
+ sbuf = smb_fname_base->st;
+ TALLOC_FREE(smb_fname_base);
}
if (ret == -1) {
*/
status = NT_STATUS_OK;
} else {
- status = walk_xattr_streams(handle, fsp, fname,
+ status = walk_xattr_streams(handle, fsp, smb_fname->base_name,
collect_one_stream, &state);
}
*pnum_streams = state.num_streams;
*pstreams = state.streams;
- return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, pnum_streams, pstreams);
+ return SMB_VFS_NEXT_STREAMINFO(handle,
+ fsp,
+ smb_fname,
+ mem_ctx,
+ pnum_streams,
+ pstreams);
}
static uint32_t streams_xattr_fs_capabilities(struct vfs_handle_struct *handle,
static NTSTATUS smb_time_audit_streaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *pnum_streams,
struct stream_struct **pstreams)
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
+ result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx,
pnum_streams, pstreams);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
static NTSTATUS um_streaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *ctx,
unsigned int *num_streams,
struct stream_struct **streams)
{
NTSTATUS status;
- char *client_path = NULL;
int ret;
+ struct smb_filename *client_fname = NULL;
DEBUG(10, ("Entering um_streaminfo\n"));
- if (!is_in_media_files(fname)) {
- return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname,
+ if (!is_in_media_files(smb_fname->base_name)) {
+ return SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname,
ctx, num_streams, streams);
}
- ret = alloc_get_client_path(handle, talloc_tos(),
- fname, &client_path);
+ ret = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &client_fname);
if (ret != 0) {
- status = map_nt_error_from_unix(errno);
goto err;
}
* function do, exactly? Does it need extra modifications for
* the Avid stuff?
*/
- status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, client_path,
+ status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, client_fname,
ctx, num_streams, streams);
err:
- TALLOC_FREE(client_path);
+ TALLOC_FREE(client_fname);
return status;
}
TALLOC_CTX *frame = talloc_stackframe();
NTSTATUS status;
- status = vfs_streaminfo(conn, NULL, smb_fname->base_name, talloc_tos(),
+ status = vfs_streaminfo(conn, NULL, smb_fname, talloc_tos(),
&num_streams, &stream_info);
if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) {
}
/* Fall back to a case-insensitive scan of all streams on the file. */
- status = vfs_streaminfo(conn, NULL, smb_fname->base_name, mem_ctx,
+ status = vfs_streaminfo(conn, NULL, smb_fname, mem_ctx,
&num_streams, &streams);
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
if (NT_STATUS_IS_OK(status) && num_names) {
file_status &= ~NO_EAS;
}
- status = vfs_streaminfo(conn, NULL, smb_fname->base_name, ctx,
+ status = vfs_streaminfo(conn, NULL, smb_fname, ctx,
&num_streams, &streams);
/* There is always one stream, ::$DATA. */
if (NT_STATUS_IS_OK(status) && num_streams > 1) {
if (NT_STATUS_IS_OK(status) && num_names) {
file_status &= ~NO_EAS;
}
- status = vfs_streaminfo(conn, NULL, smb_fname->base_name, ctx,
+ status = vfs_streaminfo(conn, NULL, smb_fname, ctx,
&num_streams, &streams);
/* There is always one stream, ::$DATA. */
if (NT_STATUS_IS_OK(status) && num_streams > 1) {
TALLOC_CTX *frame = talloc_stackframe();
NTSTATUS status;
- status = vfs_streaminfo(conn, NULL, smb_fname->base_name, talloc_tos(),
+ status = vfs_streaminfo(conn, NULL, smb_fname, talloc_tos(),
&num_streams, &stream_info);
if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)
NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid);
NTSTATUS vfs_streaminfo(connection_struct *conn,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *num_streams,
struct stream_struct **streams);
return NT_STATUS_INVALID_PARAMETER;
}
- status = vfs_streaminfo(conn, fsp, smb_fname->base_name,
- talloc_tos(), &num_streams, &streams);
+ status = vfs_streaminfo(conn,
+ fsp,
+ smb_fname,
+ talloc_tos(),
+ &num_streams,
+ &streams);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("could not get stream info: %s\n",
*/
NTSTATUS vfs_streaminfo(connection_struct *conn,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *num_streams,
struct stream_struct **streams)
{
*num_streams = 0;
*streams = NULL;
- return SMB_VFS_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams);
+ return SMB_VFS_STREAMINFO(conn,
+ fsp,
+ smb_fname,
+ mem_ctx,
+ num_streams,
+ streams);
}
/*
NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
- const char *fname,
+ const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *num_streams,
struct stream_struct **streams)
{
VFS_FIND(streaminfo);
- return handle->fns->streaminfo_fn(handle, fsp, fname, mem_ctx,
+ return handle->fns->streaminfo_fn(handle, fsp, smb_fname, mem_ctx,
num_streams, streams);
}