Remove lots of duplicate code and move it into one
[idra/samba.git] / source3 / modules / vfs_acl_common.c
1 /*
2  * Store Windows ACLs in data store - common functions.
3  * #included into modules/vfs_acl_xattr.c and modules/vfs_acl_tdb.c
4  *
5  * Copyright (C) Volker Lendecke, 2008
6  * Copyright (C) Jeremy Allison, 2009
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, see <http://www.gnu.org/licenses/>.
20  */
21
22 static NTSTATUS create_acl_blob(const struct security_descriptor *psd,
23                         DATA_BLOB *pblob,
24                         uint16_t hash_type,
25                         uint8_t hash[XATTR_SD_HASH_SIZE]);
26
27 static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
28                         vfs_handle_struct *handle,
29                         files_struct *fsp,
30                         const char *name,
31                         DATA_BLOB *pblob);
32
33 static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
34                         files_struct *fsp,
35                         DATA_BLOB *pblob);
36
37 static NTSTATUS store_acl_blob_pathname(vfs_handle_struct *handle,
38                         const char *fname,
39                         DATA_BLOB *pblob);
40
41 #define HASH_SECURITY_INFO (OWNER_SECURITY_INFORMATION | \
42                                 GROUP_SECURITY_INFORMATION | \
43                                 DACL_SECURITY_INFORMATION | \
44                                 SACL_SECURITY_INFORMATION)
45
46 /*******************************************************************
47  Hash a security descriptor.
48 *******************************************************************/
49
50 static NTSTATUS hash_sd_sha256(struct security_descriptor *psd,
51                         uint8_t *hash)
52 {
53         DATA_BLOB blob;
54         SHA256_CTX tctx;
55         NTSTATUS status;
56
57         memset(hash, '\0', XATTR_SD_HASH_SIZE);
58         status = create_acl_blob(psd, &blob, XATTR_SD_HASH_TYPE_SHA256, hash);
59         if (!NT_STATUS_IS_OK(status)) {
60                 return status;
61         }
62
63         SHA256_Init(&tctx);
64         SHA256_Update(&tctx, blob.data, blob.length);
65         SHA256_Final(hash, &tctx);
66
67         return NT_STATUS_OK;
68 }
69
70 /*******************************************************************
71  Parse out a struct security_descriptor from a DATA_BLOB.
72 *******************************************************************/
73
74 static NTSTATUS parse_acl_blob(const DATA_BLOB *pblob,
75                                 struct security_descriptor **ppdesc,
76                                 uint16_t *p_hash_type,
77                                 uint8_t hash[XATTR_SD_HASH_SIZE])
78 {
79         TALLOC_CTX *ctx = talloc_tos();
80         struct xattr_NTACL xacl;
81         enum ndr_err_code ndr_err;
82         size_t sd_size;
83
84         ndr_err = ndr_pull_struct_blob(pblob, ctx, NULL, &xacl,
85                         (ndr_pull_flags_fn_t)ndr_pull_xattr_NTACL);
86
87         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
88                 DEBUG(5, ("parse_acl_blob: ndr_pull_xattr_NTACL failed: %s\n",
89                         ndr_errstr(ndr_err)));
90                 return ndr_map_error2ntstatus(ndr_err);;
91         }
92
93         switch (xacl.version) {
94                 case 2:
95                         *ppdesc = make_sec_desc(ctx, SEC_DESC_REVISION,
96                                         xacl.info.sd_hs2->sd->type | SEC_DESC_SELF_RELATIVE,
97                                         xacl.info.sd_hs2->sd->owner_sid,
98                                         xacl.info.sd_hs2->sd->group_sid,
99                                         xacl.info.sd_hs2->sd->sacl,
100                                         xacl.info.sd_hs2->sd->dacl,
101                                         &sd_size);
102                         /* No hash - null out. */
103                         *p_hash_type = XATTR_SD_HASH_TYPE_NONE;
104                         memset(hash, '\0', XATTR_SD_HASH_SIZE);
105                         break;
106                 case 3:
107                         *ppdesc = make_sec_desc(ctx, SEC_DESC_REVISION,
108                                         xacl.info.sd_hs3->sd->type | SEC_DESC_SELF_RELATIVE,
109                                         xacl.info.sd_hs3->sd->owner_sid,
110                                         xacl.info.sd_hs3->sd->group_sid,
111                                         xacl.info.sd_hs3->sd->sacl,
112                                         xacl.info.sd_hs3->sd->dacl,
113                                         &sd_size);
114                         *p_hash_type = xacl.info.sd_hs3->hash_type;
115                         /* Current version 3. */
116                         memcpy(hash, xacl.info.sd_hs3->hash, XATTR_SD_HASH_SIZE);
117                         break;
118                 default:
119                         return NT_STATUS_REVISION_MISMATCH;
120         }
121
122         TALLOC_FREE(xacl.info.sd);
123
124         return (*ppdesc != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
125 }
126
127 /*******************************************************************
128  Create a DATA_BLOB from a security descriptor.
129 *******************************************************************/
130
131 static NTSTATUS create_acl_blob(const struct security_descriptor *psd,
132                         DATA_BLOB *pblob,
133                         uint16_t hash_type,
134                         uint8_t hash[XATTR_SD_HASH_SIZE])
135 {
136         struct xattr_NTACL xacl;
137         struct security_descriptor_hash_v3 sd_hs3;
138         enum ndr_err_code ndr_err;
139         TALLOC_CTX *ctx = talloc_tos();
140
141         ZERO_STRUCT(xacl);
142         ZERO_STRUCT(sd_hs3);
143
144         xacl.version = 3;
145         xacl.info.sd_hs3 = &sd_hs3;
146         xacl.info.sd_hs3->sd = CONST_DISCARD(struct security_descriptor *, psd);
147         xacl.info.sd_hs3->hash_type = hash_type;
148         memcpy(&xacl.info.sd_hs3->hash[0], hash, XATTR_SD_HASH_SIZE);
149
150         ndr_err = ndr_push_struct_blob(
151                         pblob, ctx, NULL, &xacl,
152                         (ndr_push_flags_fn_t)ndr_push_xattr_NTACL);
153
154         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
155                 DEBUG(5, ("create_acl_blob: ndr_push_xattr_NTACL failed: %s\n",
156                         ndr_errstr(ndr_err)));
157                 return ndr_map_error2ntstatus(ndr_err);;
158         }
159
160         return NT_STATUS_OK;
161 }
162
163 /*******************************************************************
164  Store a DATA_BLOB into an xattr given a pathname.
165 *******************************************************************/
166
167 static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
168                                 files_struct *fsp,
169                                 const char *name,
170                                 uint32_t security_info,
171                                 struct security_descriptor **ppdesc)
172 {
173         DATA_BLOB blob;
174         NTSTATUS status;
175         uint16_t hash_type;
176         uint8_t hash[XATTR_SD_HASH_SIZE];
177         uint8_t hash_tmp[XATTR_SD_HASH_SIZE];
178         struct security_descriptor *pdesc_next = NULL;
179
180         if (fsp && name == NULL) {
181                 name = fsp->fsp_name->base_name;
182         }
183
184         DEBUG(10, ("get_nt_acl_internal: name=%s\n", name));
185
186         status = get_acl_blob(talloc_tos(), handle, fsp, name, &blob);
187         if (!NT_STATUS_IS_OK(status)) {
188                 DEBUG(10, ("get_acl_blob returned %s\n", nt_errstr(status)));
189                 return status;
190         }
191
192         status = parse_acl_blob(&blob, ppdesc,
193                                 &hash_type, &hash[0]);
194         if (!NT_STATUS_IS_OK(status)) {
195                 DEBUG(10, ("parse_acl_blob returned %s\n",
196                                 nt_errstr(status)));
197                 return status;
198         }
199
200         /* Ensure the hash type is one we know. */
201         switch (hash_type) {
202                 case XATTR_SD_HASH_TYPE_NONE:
203                         /* No hash, goto return blob sd. */
204                         goto out;
205                 case XATTR_SD_HASH_TYPE_SHA256:
206                         break;
207                 default:
208                         return NT_STATUS_REVISION_MISMATCH;
209         }
210
211         /* Get the full underlying sd, then hash. */
212         if (fsp) {
213                 status = SMB_VFS_NEXT_FGET_NT_ACL(handle,
214                                 fsp,
215                                 HASH_SECURITY_INFO,
216                                 &pdesc_next);
217         } else {
218                 status = SMB_VFS_NEXT_GET_NT_ACL(handle,
219                                 name,
220                                 HASH_SECURITY_INFO,
221                                 &pdesc_next);
222         }
223
224         if (!NT_STATUS_IS_OK(status)) {
225                 goto out;
226         }
227
228         status = hash_sd_sha256(pdesc_next, hash_tmp);
229         if (!NT_STATUS_IS_OK(status)) {
230                 goto out;
231         }
232
233         if (memcmp(&hash[0], &hash_tmp[0], XATTR_SD_HASH_SIZE) == 0) {
234                 TALLOC_FREE(pdesc_next);
235                 /* Hash matches, return blob sd. */
236                 goto out;
237         }
238
239         /* Hash doesn't match, return underlying sd. */
240
241         if (!(security_info & OWNER_SECURITY_INFORMATION)) {
242                 pdesc_next->owner_sid = NULL;
243         }
244         if (!(security_info & GROUP_SECURITY_INFORMATION)) {
245                 pdesc_next->group_sid = NULL;
246         }
247         if (!(security_info & DACL_SECURITY_INFORMATION)) {
248                 pdesc_next->dacl = NULL;
249         }
250         if (!(security_info & SACL_SECURITY_INFORMATION)) {
251                 pdesc_next->sacl = NULL;
252         }
253
254         TALLOC_FREE(*ppdesc);
255         *ppdesc = pdesc_next;
256
257   out:
258
259         if (!(security_info & OWNER_SECURITY_INFORMATION)) {
260                 (*ppdesc)->owner_sid = NULL;
261         }
262         if (!(security_info & GROUP_SECURITY_INFORMATION)) {
263                 (*ppdesc)->group_sid = NULL;
264         }
265         if (!(security_info & DACL_SECURITY_INFORMATION)) {
266                 (*ppdesc)->dacl = NULL;
267         }
268         if (!(security_info & SACL_SECURITY_INFORMATION)) {
269                 (*ppdesc)->sacl = NULL;
270         }
271
272         TALLOC_FREE(blob.data);
273         return status;
274 }
275
276 /*********************************************************************
277  Create a default security descriptor for a file in case no inheritance
278  exists. All permissions to the owner and SYSTEM.
279 *********************************************************************/
280
281 static struct security_descriptor *default_file_sd(TALLOC_CTX *mem_ctx,
282                                                 SMB_STRUCT_STAT *psbuf)
283 {
284         struct dom_sid owner_sid, group_sid;
285         size_t sd_size;
286         struct security_ace *pace = NULL;
287         struct security_acl *pacl = NULL;
288
289         uid_to_sid(&owner_sid, psbuf->st_ex_uid);
290         gid_to_sid(&group_sid, psbuf->st_ex_gid);
291
292         pace = TALLOC_ARRAY(mem_ctx, struct security_ace, 2);
293         if (!pace) {
294                 return NULL;
295         }
296
297         init_sec_ace(&pace[0], &owner_sid, SEC_ACE_TYPE_ACCESS_ALLOWED,
298                         SEC_RIGHTS_FILE_ALL, 0);
299         init_sec_ace(&pace[1], &global_sid_System, SEC_ACE_TYPE_ACCESS_ALLOWED,
300                         SEC_RIGHTS_FILE_ALL, 0);
301
302         pacl = make_sec_acl(mem_ctx,
303                                 NT4_ACL_REVISION,
304                                 2,
305                                 pace);
306         if (!pacl) {
307                 return NULL;
308         }
309         return make_sec_desc(mem_ctx,
310                         SECURITY_DESCRIPTOR_REVISION_1,
311                         SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT,
312                         &owner_sid,
313                         &group_sid,
314                         NULL,
315                         pacl,
316                         &sd_size);
317 }
318
319 /*********************************************************************
320 *********************************************************************/
321
322 static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
323                                         struct smb_filename *smb_fname,
324                                         files_struct *fsp,
325                                         bool container)
326 {
327         TALLOC_CTX *ctx = talloc_tos();
328         NTSTATUS status;
329         struct security_descriptor *parent_desc = NULL;
330         struct security_descriptor *psd = NULL;
331         struct security_descriptor *pdesc_next = NULL;
332         DATA_BLOB blob;
333         size_t size;
334         char *parent_name;
335         uint8_t hash[XATTR_SD_HASH_SIZE];
336
337         if (!parent_dirname(ctx, smb_fname->base_name, &parent_name, NULL)) {
338                 return NT_STATUS_NO_MEMORY;
339         }
340
341         DEBUG(10,("inherit_new_acl: check directory %s\n",
342                         parent_name));
343
344         status = get_nt_acl_internal(handle,
345                                 NULL,
346                                 parent_name,
347                                 (OWNER_SECURITY_INFORMATION |
348                                  GROUP_SECURITY_INFORMATION |
349                                  DACL_SECURITY_INFORMATION),
350                                 &parent_desc);
351         if (NT_STATUS_IS_OK(status)) {
352                 /* Create an inherited descriptor from the parent. */
353
354                 if (DEBUGLEVEL >= 10) {
355                         DEBUG(10,("inherit_new_acl: parent acl is:\n"));
356                         NDR_PRINT_DEBUG(security_descriptor, parent_desc);
357                 }
358
359                 status = se_create_child_secdesc(ctx,
360                                 &psd,
361                                 &size,
362                                 parent_desc,
363                                 &handle->conn->server_info->ptok->user_sids[PRIMARY_USER_SID_INDEX],
364                                 &handle->conn->server_info->ptok->user_sids[PRIMARY_GROUP_SID_INDEX],
365                                 container);
366                 if (!NT_STATUS_IS_OK(status)) {
367                         return status;
368                 }
369
370                 if (DEBUGLEVEL >= 10) {
371                         DEBUG(10,("inherit_new_acl: child acl is:\n"));
372                         NDR_PRINT_DEBUG(security_descriptor, psd);
373                 }
374
375         } else {
376                 DEBUG(10,("inherit_new_acl: directory %s failed "
377                         "to get acl %s\n",
378                         parent_name,
379                         nt_errstr(status) ));
380         }
381
382         if (!psd || psd->dacl == NULL) {
383
384                 TALLOC_FREE(psd);
385                 if (fsp) {
386                         status = vfs_stat_fsp(fsp);
387                         smb_fname->st = fsp->fsp_name->st;
388                 } else {
389                         int ret;
390                         if (lp_posix_pathnames()) {
391                                 ret = SMB_VFS_LSTAT(handle->conn, smb_fname);
392                         } else {
393                                 ret = SMB_VFS_STAT(handle->conn, smb_fname);
394                         }
395                         if (ret == -1) {
396                                 status = map_nt_error_from_unix(errno);
397                         }
398                 }
399                 if (!NT_STATUS_IS_OK(status)) {
400                         return status;
401                 }
402
403                 psd = default_file_sd(ctx, &smb_fname->st);
404                 if (!psd) {
405                         return NT_STATUS_NO_MEMORY;
406                 }
407
408                 if (DEBUGLEVEL >= 10) {
409                         DEBUG(10,("inherit_new_acl: default acl is:\n"));
410                         NDR_PRINT_DEBUG(security_descriptor, psd);
411                 }
412         }
413
414         /* Object exists. Read the current SD to get the hash. */
415         if (fsp) {
416                 status = SMB_VFS_NEXT_FGET_NT_ACL(handle,
417                                 fsp,
418                                 HASH_SECURITY_INFO,
419                                 &pdesc_next);
420         } else {
421                 status = SMB_VFS_NEXT_GET_NT_ACL(handle,
422                                 smb_fname->base_name,
423                                 HASH_SECURITY_INFO,
424                                 &pdesc_next);
425         }
426
427         if (!NT_STATUS_IS_OK(status)) {
428                 return status;
429         }
430
431         status = hash_sd_sha256(pdesc_next, hash);
432         if (!NT_STATUS_IS_OK(status)) {
433                 return status;
434         }
435         status = create_acl_blob(psd, &blob, XATTR_SD_HASH_TYPE_SHA256, hash);
436         if (!NT_STATUS_IS_OK(status)) {
437                 return status;
438         }
439         if (fsp) {
440                 return store_acl_blob_fsp(handle, fsp, &blob);
441         } else {
442                 return store_acl_blob_pathname(handle, smb_fname->base_name,
443                                                &blob);
444         }
445 }
446
447 /*********************************************************************
448  Check ACL on open. For new files inherit from parent directory.
449 *********************************************************************/
450
451 static int open_acl_common(vfs_handle_struct *handle,
452                         struct smb_filename *smb_fname,
453                         files_struct *fsp,
454                         int flags,
455                         mode_t mode)
456 {
457         uint32_t access_granted = 0;
458         struct security_descriptor *pdesc = NULL;
459         bool file_existed = true;
460         char *fname = NULL;
461         NTSTATUS status;
462
463         if (fsp->base_fsp) {
464                 /* Stream open. Base filename open already did the ACL check. */
465                 DEBUG(10,("open_acl_common: stream open on %s\n",
466                         smb_fname_str_dbg(smb_fname) ));
467                 return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
468         }
469
470         status = get_full_smb_filename(talloc_tos(), smb_fname,
471                                        &fname);
472         if (!NT_STATUS_IS_OK(status)) {
473                 errno = map_errno_from_nt_status(status);
474                 return -1;
475         }
476
477         status = get_nt_acl_internal(handle,
478                                 NULL,
479                                 fname,
480                                 (OWNER_SECURITY_INFORMATION |
481                                  GROUP_SECURITY_INFORMATION |
482                                  DACL_SECURITY_INFORMATION),
483                                 &pdesc);
484         if (NT_STATUS_IS_OK(status)) {
485                 /* See if we can access it. */
486                 status = smb1_file_se_access_check(pdesc,
487                                         handle->conn->server_info->ptok,
488                                         fsp->access_mask,
489                                         &access_granted);
490                 if (!NT_STATUS_IS_OK(status)) {
491                         DEBUG(10,("open_acl_xattr: file %s open "
492                                 "refused with error %s\n",
493                                 smb_fname_str_dbg(smb_fname),
494                                 nt_errstr(status) ));
495                         errno = map_errno_from_nt_status(status);
496                         return -1;
497                 }
498         } else if (NT_STATUS_EQUAL(status,NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
499                 file_existed = false;
500         }
501
502         DEBUG(10,("open_acl_xattr: get_nt_acl_attr_internal for "
503                 "file %s returned %s\n",
504                 smb_fname_str_dbg(smb_fname),
505                 nt_errstr(status) ));
506
507         fsp->fh->fd = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
508
509         if (!file_existed && fsp->fh->fd != -1) {
510                 /* File was created. Inherit from parent directory. */
511                 status = fsp_set_smb_fname(fsp, smb_fname);
512                 if (!NT_STATUS_IS_OK(status)) {
513                         errno = map_errno_from_nt_status(status);
514                         return -1;
515                 }
516                 inherit_new_acl(handle, smb_fname, fsp, false);
517         }
518
519         return fsp->fh->fd;
520 }
521
522 static int mkdir_acl_common(vfs_handle_struct *handle, const char *path, mode_t mode)
523 {
524         struct smb_filename *smb_fname = NULL;
525         int ret = SMB_VFS_NEXT_MKDIR(handle, path, mode);
526         NTSTATUS status;
527
528         if (ret == -1) {
529                 return ret;
530         }
531
532         status = create_synthetic_smb_fname(talloc_tos(), path, NULL, NULL,
533                                             &smb_fname);
534         if (!NT_STATUS_IS_OK(status)) {
535                 errno = map_errno_from_nt_status(status);
536                 return -1;
537         }
538
539         /* New directory - inherit from parent. */
540         inherit_new_acl(handle, smb_fname, NULL, true);
541         TALLOC_FREE(smb_fname);
542         return ret;
543 }
544
545 /*********************************************************************
546  Fetch a security descriptor given an fsp.
547 *********************************************************************/
548
549 static NTSTATUS fget_nt_acl_common(vfs_handle_struct *handle, files_struct *fsp,
550         uint32_t security_info, struct security_descriptor **ppdesc)
551 {
552         return get_nt_acl_internal(handle, fsp,
553                                 NULL, security_info, ppdesc);
554 }
555
556 /*********************************************************************
557  Fetch a security descriptor given a pathname.
558 *********************************************************************/
559
560 static NTSTATUS get_nt_acl_common(vfs_handle_struct *handle,
561         const char *name, uint32_t security_info, struct security_descriptor **ppdesc)
562 {
563         return get_nt_acl_internal(handle, NULL,
564                                 name, security_info, ppdesc);
565 }
566
567 /*********************************************************************
568  Store a security descriptor given an fsp.
569 *********************************************************************/
570
571 static NTSTATUS fset_nt_acl_common(vfs_handle_struct *handle, files_struct *fsp,
572         uint32_t security_info_sent, const struct security_descriptor *psd)
573 {
574         NTSTATUS status;
575         DATA_BLOB blob;
576         struct security_descriptor *pdesc_next = NULL;
577         uint8_t hash[XATTR_SD_HASH_SIZE];
578
579         if (DEBUGLEVEL >= 10) {
580                 DEBUG(10,("fset_nt_acl_xattr: incoming sd for file %s\n",
581                           fsp_str_dbg(fsp)));
582                 NDR_PRINT_DEBUG(security_descriptor,
583                         CONST_DISCARD(struct security_descriptor *,psd));
584         }
585
586         /* Ensure owner and group are set. */
587         if (!psd->owner_sid || !psd->group_sid) {
588                 DOM_SID owner_sid, group_sid;
589                 struct security_descriptor *nc_psd = dup_sec_desc(talloc_tos(), psd);
590
591                 if (!nc_psd) {
592                         return NT_STATUS_OK;
593                 }
594                 status = vfs_stat_fsp(fsp);
595                 if (!NT_STATUS_IS_OK(status)) {
596                         /* Lower level acl set succeeded,
597                          * so still return OK. */
598                         return NT_STATUS_OK;
599                 }
600                 create_file_sids(&fsp->fsp_name->st, &owner_sid, &group_sid);
601                 /* This is safe as nc_psd is discarded at fn exit. */
602                 nc_psd->owner_sid = &owner_sid;
603                 nc_psd->group_sid = &group_sid;
604                 security_info_sent |= (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION);
605                 psd = nc_psd;
606         }
607
608         status = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
609         if (!NT_STATUS_IS_OK(status)) {
610                 return status;
611         }
612
613         /* Get the full underlying sd, then hash. */
614         status = SMB_VFS_NEXT_FGET_NT_ACL(handle,
615                                 fsp,
616                                 HASH_SECURITY_INFO,
617                                 &pdesc_next);
618
619         if (!NT_STATUS_IS_OK(status)) {
620                 return status;
621         }
622
623         status = hash_sd_sha256(pdesc_next, hash);
624         if (!NT_STATUS_IS_OK(status)) {
625                 return status;
626         }
627
628         if (DEBUGLEVEL >= 10) {
629                 DEBUG(10,("fset_nt_acl_xattr: storing xattr sd for file %s\n",
630                           fsp_str_dbg(fsp)));
631                 NDR_PRINT_DEBUG(security_descriptor,
632                         CONST_DISCARD(struct security_descriptor *,psd));
633         }
634         create_acl_blob(psd, &blob, XATTR_SD_HASH_TYPE_SHA256, hash);
635         store_acl_blob_fsp(handle, fsp, &blob);
636
637         return NT_STATUS_OK;
638 }