From: Noel Power Date: Wed, 28 Apr 2021 08:51:05 +0000 (+0100) Subject: s3/smbd: add new toplevel vfs_fstreaminfo wrapper X-Git-Tag: tevent-0.11.0~924 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4842710aaa7d14aec83e70d8d9dbbf465c3c4c1f;p=thirdparty%2Fsamba.git s3/smbd: add new toplevel vfs_fstreaminfo wrapper This will allow for calling SMB_VFS_FSTREAMINFO in a piecemeal fashion, at the end of the patch set vfs_fstreaminfo will replace vfs_streaminfo Signed-off-by: Noel Power Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index b0707356b80..05308393d64 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -1335,6 +1335,10 @@ NTSTATUS vfs_streaminfo(connection_struct *conn, TALLOC_CTX *mem_ctx, unsigned int *num_streams, struct stream_struct **streams); +NTSTATUS vfs_fstreaminfo(struct files_struct *fsp, + TALLOC_CTX *mem_ctx, + unsigned int *num_streams, + struct stream_struct **streams); void init_smb_file_time(struct smb_file_time *ft); int vfs_fake_fd(void); int vfs_fake_fd_close(int fd); diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 9104db06690..9108ef2c895 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -1593,6 +1593,36 @@ NTSTATUS vfs_streaminfo(connection_struct *conn, streams); } +NTSTATUS vfs_fstreaminfo(struct files_struct *fsp, + TALLOC_CTX *mem_ctx, + unsigned int *num_streams, + struct stream_struct **streams) +{ + *num_streams = 0; + *streams = NULL; + + if (fsp == NULL) { + /* + * Callers may pass fsp == NULL when passing smb_fname->fsp of a + * symlink. This is ok, handle it here, by just return no + * streams on a symlink. + */ + return NT_STATUS_OK; + } + + if (fsp_get_pathref_fd(fsp) == -1) { + /* + * No streams on non-real files/directories. + */ + return NT_STATUS_OK; + } + + return SMB_VFS_FSTREAMINFO(fsp, + mem_ctx, + num_streams, + streams); +} + int vfs_fake_fd(void) { int pipe_fds[2];