xref: /haiku/src/add-ons/kernel/file_systems/ntfs/libntfs/security.h (revision 8195a5a835117ab2da405e0d477153570b75d921)
1 /*
2  * security.h - Exports for handling security/ACLs in NTFS.
3  *              Originated from the Linux-NTFS project.
4  *
5  * Copyright (c) 2004      Anton Altaparmakov
6  * Copyright (c) 2005-2006 Szabolcs Szakacsits
7  *
8  * This program/include file is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as published
10  * by the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program/include file is distributed in the hope that it will be
14  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15  * of 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 (in the main directory of the NTFS-3G
20  * distribution in the file COPYING); if not, write to the Free Software
21  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23 
24 #ifndef _NTFS_SECURITY_H
25 #define _NTFS_SECURITY_H
26 
27 #include "types.h"
28 #include "layout.h"
29 #include "inode.h"
30 
31 extern const GUID *const zero_guid;
32 
33 extern BOOL ntfs_guid_is_zero(const GUID *guid);
34 extern char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str);
35 
36 /**
37  * ntfs_sid_is_valid - determine if a SID is valid
38  * @sid:	SID for which to determine if it is valid
39  *
40  * Determine if the SID pointed to by @sid is valid.
41  *
42  * Return TRUE if it is valid and FALSE otherwise.
43  */
44 static __inline__ BOOL ntfs_sid_is_valid(const SID *sid)
45 {
46 	if (!sid || sid->revision != SID_REVISION ||
47 			sid->sub_authority_count > SID_MAX_SUB_AUTHORITIES)
48 		return FALSE;
49 	return TRUE;
50 }
51 
52 extern int ntfs_sid_to_mbs_size(const SID *sid);
53 extern char *ntfs_sid_to_mbs(const SID *sid, char *sid_str,
54 		size_t sid_str_size);
55 extern void ntfs_generate_guid(GUID *guid);
56 extern int ntfs_sd_add_everyone(ntfs_inode *ni);
57 
58 #endif /* defined _NTFS_SECURITY_H */
59