]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:adouble: add adouble_open_from_base_fsp()
authorStefan Metzmacher <metze@samba.org>
Wed, 23 Dec 2020 10:58:08 +0000 (11:58 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 21 Jan 2021 13:35:33 +0000 (13:35 +0000)
For now we only support ADOUBLE_RSRC, but that might change in future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/lib/adouble.c
source3/lib/adouble.h

index abd901b2172a35aee8cb32e47499973eabf3696c..e869965876d209135fcf807154aaa7900abb0d35 100644 (file)
@@ -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
index 90a825c502e08f1325856e4a52d10d980992591d..a5761281670d56fd2ded4fae18192a123b7dee0c 100644 (file)
@@ -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,