From: Stefan Metzmacher Date: Wed, 23 Dec 2020 10:58:08 +0000 (+0100) Subject: s3:adouble: add adouble_open_from_base_fsp() X-Git-Tag: tevent-0.11.0~2040 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d62c670c3dd33eafc515ee92be177d1ddcb7b0a9;p=thirdparty%2Fsamba.git s3:adouble: add adouble_open_from_base_fsp() For now we only support ADOUBLE_RSRC, but that might change in future. Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/source3/lib/adouble.c b/source3/lib/adouble.c index abd901b2172..e869965876d 100644 --- a/source3/lib/adouble.c +++ b/source3/lib/adouble.c @@ -2156,6 +2156,32 @@ static NTSTATUS adouble_open_rsrc_fsp(const struct files_struct *dirfsp, return NT_STATUS_OK; } +NTSTATUS adouble_open_from_base_fsp(const struct files_struct *dirfsp, + struct files_struct *base_fsp, + adouble_type_t type, + int flags, + mode_t mode, + struct files_struct **_ad_fsp) +{ + *_ad_fsp = NULL; + + SMB_ASSERT(base_fsp != NULL); + SMB_ASSERT(base_fsp->base_fsp == NULL); + + switch (type) { + case ADOUBLE_META: + return NT_STATUS_INTERNAL_ERROR; + case ADOUBLE_RSRC: + return adouble_open_rsrc_fsp(dirfsp, + base_fsp->fsp_name, + flags, + mode, + _ad_fsp); + } + + return NT_STATUS_INTERNAL_ERROR; +} + /* * Here's the deal: for ADOUBLE_META we can do without an fd as we can issue * path based xattr calls. For ADOUBLE_RSRC however we need a full-fledged fd diff --git a/source3/lib/adouble.h b/source3/lib/adouble.h index 90a825c502e..a5761281670 100644 --- a/source3/lib/adouble.h +++ b/source3/lib/adouble.h @@ -164,6 +164,12 @@ bool ad_unconvert(TALLOC_CTX *mem_ctx, struct smb_filename *smb_fname, bool *converted); struct adouble *ad_init(TALLOC_CTX *ctx, adouble_type_t type); +NTSTATUS adouble_open_from_base_fsp(const struct files_struct *dirfsp, + struct files_struct *base_fsp, + adouble_type_t type, + int flags, + mode_t mode, + struct files_struct **_ad_fsp); struct adouble *ad_get(TALLOC_CTX *ctx, vfs_handle_struct *handle, const struct smb_filename *smb_fname,