LCOV - code coverage report
Current view: top level - source3/modules - non_posix_acls.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 0 22 0.0 %
Date: 2024-04-21 15:09:00 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             :    Access Control List handling
       4             :    Copyright (C) Andrew Bartlett 2012.
       5             : 
       6             :    This program is free software; you can redistribute it and/or modify
       7             :    it under the terms of the GNU General Public License as published by
       8             :    the Free Software Foundation; either version 3 of the License, or
       9             :    (at your option) any later version.
      10             : 
      11             :    This program is distributed in the hope that it will be useful,
      12             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             :    GNU General Public License for more details.
      15             : 
      16             :    You should have received a copy of the GNU General Public License
      17             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      18             : */
      19             : 
      20             : #include "includes.h"
      21             : #include "../librpc/gen_ndr/ndr_xattr.h"
      22             : #include "modules/non_posix_acls.h"
      23             : 
      24           0 : int non_posix_sys_acl_blob_get_fd_helper(vfs_handle_struct *handle,
      25             :                                          files_struct *fsp,
      26             :                                          DATA_BLOB acl_as_blob,
      27             :                                          TALLOC_CTX *mem_ctx,
      28             :                                          DATA_BLOB *blob)
      29             : {
      30           0 :         SMB_STRUCT_STAT sbuf;
      31           0 :         TALLOC_CTX *frame;
      32           0 :         struct xattr_sys_acl_hash_wrapper acl_wrapper;
      33           0 :         int ret;
      34             : 
      35           0 :         frame = talloc_stackframe();
      36             : 
      37           0 :         acl_wrapper.acl_as_blob = acl_as_blob;
      38             : 
      39           0 :         if (!VALID_STAT(fsp->fsp_name->st)) {
      40           0 :                 ret = smb_vfs_call_fstat(handle, fsp, &sbuf);
      41           0 :                 if (ret == -1) {
      42           0 :                         TALLOC_FREE(frame);
      43           0 :                         return -1;
      44             :                 }
      45             :         } else {
      46           0 :                 sbuf = fsp->fsp_name->st;
      47             :         }
      48             : 
      49           0 :         acl_wrapper.owner = sbuf.st_ex_uid;
      50           0 :         acl_wrapper.group = sbuf.st_ex_gid;
      51           0 :         acl_wrapper.mode = sbuf.st_ex_mode;
      52             : 
      53           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_struct_blob(blob, mem_ctx,
      54             :                                                           &acl_wrapper,
      55             :                                                           (ndr_push_flags_fn_t)ndr_push_xattr_sys_acl_hash_wrapper))) {
      56           0 :                 errno = EINVAL;
      57           0 :                 TALLOC_FREE(frame);
      58           0 :                 return -1;
      59             :         }
      60             : 
      61           0 :         TALLOC_FREE(frame);
      62           0 :         return 0;
      63             : }

Generated by: LCOV version 1.14