1 /*
   2  * security.h - Exports for handling security/ACLs in NTFS.  Part of the
   3  *              Linux-NTFS project.
   4  *
   5  * Copyright (c) 2004 Anton Altaparmakov
   6  *
   7  * This program/include file is free software; you can redistribute it and/or
   8  * modify it under the terms of the GNU General Public License as published
   9  * by the Free Software Foundation; either version 2 of the License, or
  10  * (at your option) any later version.
  11  *
  12  * This program/include file is distributed in the hope that it will be
  13  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  * GNU General Public License for more details.
  16  *
  17  * You should have received a copy of the GNU General Public License
  18  * along with this program (in the main directory of the Linux-NTFS
  19  * distribution in the file COPYING); if not, write to the Free Software
  20  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  21  */
  22 
  23 #ifndef _NTFS_SECURITY_H
  24 #define _NTFS_SECURITY_H
  25 
  26 #include "types.h"
  27 #include "layout.h"
  28 
  29 extern const GUID *const zero_guid;
  30 
  31 extern BOOL ntfs_guid_is_zero(const GUID *guid);
  32 extern char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str);
  33 
  34 /**
  35  * ntfs_sid_is_valid - determine if a SID is valid
  36  * @sid:        SID for which to determine if it is valid
  37  *
  38  * Determine if the SID pointed to by @sid is valid.
  39  *
  40  * Return TRUE if it is valid and FALSE otherwise.
  41  */
  42 static __inline__ BOOL ntfs_sid_is_valid(const SID *sid)
  43 {
  44         if (!sid || sid->revision != SID_REVISION ||
  45                         sid->sub_authority_count > SID_MAX_SUB_AUTHORITIES)
  46                 return FALSE;
  47         return TRUE;
  48 }
  49 
  50 extern int ntfs_sid_to_mbs_size(const SID *sid);
  51 extern char *ntfs_sid_to_mbs(const SID *sid, char *sid_str,
  52                 size_t sid_str_size);
  53 extern void ntfs_generate_guid(GUID *guid);
  54 
  55 #endif /* defined _NTFS_SECURITY_H */