]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: snapper. Add snapper_gmt_get_nt_acl_at().
authorJeremy Allison <jra@samba.org>
Mon, 13 Apr 2020 21:09:24 +0000 (14:09 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 7 May 2020 19:27:35 +0000 (19:27 +0000)
Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_snapper.c

index da6b0b581b9902c12866f4d62e2cc7468220c9ec..472ae7e172314b6e5e2a89a40ffad0427e42640b 100644 (file)
@@ -2378,6 +2378,65 @@ static NTSTATUS snapper_gmt_get_nt_acl(vfs_handle_struct *handle,
        return status;
 }
 
+static NTSTATUS snapper_gmt_get_nt_acl_at(vfs_handle_struct *handle,
+                               struct files_struct *dirfsp,
+                               const struct smb_filename *fname,
+                               uint32_t security_info,
+                               TALLOC_CTX *mem_ctx,
+                               struct security_descriptor **ppdesc)
+{
+       time_t timestamp;
+       char *stripped;
+       NTSTATUS status;
+       char *conv;
+       struct smb_filename *smb_fname = NULL;
+       bool ok;
+
+       ok = snapper_gmt_strip_snapshot(talloc_tos(),
+                                       handle,
+                                       fname,
+                                       &timestamp,
+                                       &stripped);
+       if (!ok) {
+               return map_nt_error_from_unix(errno);
+       }
+       if (timestamp == 0) {
+               return SMB_VFS_NEXT_GET_NT_ACL_AT(handle,
+                                               dirfsp,
+                                               fname,
+                                               security_info,
+                                               mem_ctx,
+                                               ppdesc);
+       }
+       conv = snapper_gmt_convert(talloc_tos(),
+                                       handle,
+                                       stripped,
+                                       timestamp);
+       TALLOC_FREE(stripped);
+       if (conv == NULL) {
+               return map_nt_error_from_unix(errno);
+       }
+       smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       conv,
+                                       NULL,
+                                       NULL,
+                                       0,
+                                       fname->flags);
+       TALLOC_FREE(conv);
+       if (smb_fname == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       status = SMB_VFS_NEXT_GET_NT_ACL_AT(handle,
+                                       dirfsp,
+                                       smb_fname,
+                                       security_info,
+                                       mem_ctx,
+                                       ppdesc);
+       TALLOC_FREE(smb_fname);
+       return status;
+}
+
 static int snapper_gmt_mkdirat(vfs_handle_struct *handle,
                                struct files_struct *dirfsp,
                                const struct smb_filename *fname,
@@ -2755,6 +2814,7 @@ static struct vfs_fn_pointers snapper_fns = {
        .mknodat_fn = snapper_gmt_mknodat,
        .realpath_fn = snapper_gmt_realpath,
        .get_nt_acl_fn = snapper_gmt_get_nt_acl,
+       .get_nt_acl_at_fn = snapper_gmt_get_nt_acl_at,
        .mkdirat_fn = snapper_gmt_mkdirat,
        .getxattr_fn = snapper_gmt_getxattr,
        .getxattrat_send_fn = vfs_not_implemented_getxattrat_send,