LCOV - code coverage report
Current view: top level - source3/modules - nfs4acl_xattr_util.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 16 18 88.9 %
Date: 2021-09-23 10:06:22 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (C) Ralph Boehme 2018
       3             :  *
       4             :  * This program is free software; you can redistribute it and/or modify
       5             :  * it under the terms of the GNU General Public License as published by
       6             :  * the Free Software Foundation; either version 3 of the License, or
       7             :  * (at your option) any later version.
       8             :  *
       9             :  * This program is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :  * GNU General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU General Public License
      15             :  * along with this program; if not, see <http://www.gnu.org/licenses/>.
      16             :  *
      17             :  */
      18             : 
      19             : #include "includes.h"
      20             : #include "smbd/proto.h"
      21             : #include "libcli/security/security_descriptor.h"
      22             : 
      23             : #ifdef HAVE_RPC_XDR_H
      24             : /* <rpc/xdr.h> uses TRUE and FALSE */
      25             : #ifdef TRUE
      26             : #undef TRUE
      27             : #endif
      28             : 
      29             : #ifdef FALSE
      30             : #undef FALSE
      31             : #endif
      32             : #endif
      33             : 
      34             : #include "nfs4_acls.h"
      35             : #include "nfs41acl.h"
      36             : #include "nfs4acl_xattr_util.h"
      37             : 
      38             : #undef DBGC_CLASS
      39             : #define DBGC_CLASS DBGC_VFS
      40             : 
      41        1428 : unsigned smb4acl_to_nfs4acl_flags(uint16_t smb4acl_flags)
      42             : {
      43        1428 :         unsigned nfs4acl_flags = 0;
      44             : 
      45        1428 :         if (smb4acl_flags & SEC_DESC_DACL_AUTO_INHERITED) {
      46         228 :                 nfs4acl_flags |= ACL4_AUTO_INHERIT;
      47             :         }
      48        1428 :         if (smb4acl_flags & SEC_DESC_DACL_PROTECTED) {
      49         476 :                 nfs4acl_flags |= ACL4_PROTECTED;
      50             :         }
      51        1428 :         if (smb4acl_flags & SEC_DESC_DACL_DEFAULTED) {
      52           0 :                 nfs4acl_flags |= ACL4_DEFAULTED;
      53             :         }
      54             : 
      55        1428 :         return nfs4acl_flags;
      56             : }
      57             : 
      58        2508 : uint16_t nfs4acl_to_smb4acl_flags(unsigned nfsacl41_flags)
      59             : {
      60        2508 :         uint16_t smb4acl_flags = SEC_DESC_SELF_RELATIVE;
      61             : 
      62        2508 :         if (nfsacl41_flags & ACL4_AUTO_INHERIT) {
      63         296 :                 smb4acl_flags |= SEC_DESC_DACL_AUTO_INHERITED;
      64             :         }
      65        2508 :         if (nfsacl41_flags & ACL4_PROTECTED) {
      66         588 :                 smb4acl_flags |= SEC_DESC_DACL_PROTECTED;
      67             :         }
      68        2508 :         if (nfsacl41_flags & ACL4_DEFAULTED) {
      69           0 :                 smb4acl_flags |= SEC_DESC_DACL_DEFAULTED;
      70             :         }
      71             : 
      72        2508 :         return smb4acl_flags;
      73             : }

Generated by: LCOV version 1.13