]> wimlib.net Git - wimlib/blobdiff - include/wimlib/security_descriptor.h
mount_image.c: add fallback definitions of RENAME_* constants
[wimlib] / include / wimlib / security_descriptor.h
index 415de8641632008b8ebc20050fb95de9ad2a2be8..f5c5a34c5bdf0cefe1504a271e96aeb092dfd018 100644 (file)
@@ -1,3 +1,30 @@
+/*
+ * security_descriptor.h - declarations for Windows security descriptor format
+ *
+ * Copyright 2022 Eric Biggers
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #ifndef _WIMLIB_SECURITY_DESCRIPTOR_H
 #define _WIMLIB_SECURITY_DESCRIPTOR_H
 
@@ -31,7 +58,7 @@ typedef struct {
        /* Offset of Discretionary Access Control List (DACL) in security
         * descriptor, or 0 if no DACL is present  */
        le32 dacl_offset;
-} _packed_attribute wimlib_SECURITY_DESCRIPTOR_RELATIVE;
+} __attribute__((packed)) wimlib_SECURITY_DESCRIPTOR_RELATIVE;
 
 #define wimlib_SE_OWNER_DEFAULTED              0x0001
 #define wimlib_SE_GROUP_DEFAULTED              0x0002
@@ -48,39 +75,17 @@ typedef struct {
 #define wimlib_SE_RM_CONTROL_VALID             0x4000
 #define wimlib_SE_SELF_RELATIVE                        0x8000
 
-/* Header of a Windows NT access control entry  */
+/* Windows NT security identifier (user or group)  */
 typedef struct {
-       /* Type of ACE  */
-       u8 type;
-
-       /* Bitwise OR of inherit ACE flags  */
-       u8 flags;
 
-       /* Size of the access control entry, including this header  */
-       le16 size;
-} _packed_attribute wimlib_ACE_HEADER;
-
-/* Windows NT access control entry to grant rights to a user or group  */
-typedef struct {
-       wimlib_ACE_HEADER hdr;
-       le32 mask;
-       le32 sid_start;
-} _packed_attribute wimlib_ACCESS_ALLOWED_ACE;
-
-/* Windows NT access control entry to deny rights to a user or group  */
-typedef struct {
-       wimlib_ACE_HEADER hdr;
-       le32 mask;
-       le32 sid_start;
-} _packed_attribute wimlib_ACCESS_DENIED_ACE;
+       u8  revision;
+       u8  sub_authority_count;
 
-/* Windows NT access control entry to audit access to the object  */
-typedef struct {
-       wimlib_ACE_HEADER hdr;
-       le32 mask;
-       le32 sid_start;
-} _packed_attribute wimlib_SYSTEM_AUDIT_ACE;
+       /* Identifies the authority that issued the SID  */
+       u8  identifier_authority[6];
 
+       le32 sub_authority[];
+} __attribute__((packed)) wimlib_SID;
 
 /* Header of a Windows NT access control list  */
 typedef struct {
@@ -99,18 +104,43 @@ typedef struct {
 
        /* padding  */
        le16 sbz2;
-} _packed_attribute wimlib_ACL;
+} __attribute__((packed)) wimlib_ACL;
 
-/* Windows NT security identifier (user or group)  */
+#define wimlib_ACCESS_ALLOWED_ACE_TYPE         0
+#define wimlib_ACCESS_DENIED_ACE_TYPE          1
+#define wimlib_SYSTEM_AUDIT_ACE_TYPE           2
+
+/* Header of a Windows NT access control entry  */
 typedef struct {
+       /* Type of ACE  */
+       u8 type;
 
-       u8  revision;
-       u8  sub_authority_count;
+       /* Bitwise OR of inherit ACE flags  */
+       u8 flags;
 
-       /* Identifies the authority that issued the SID  */
-       u8  identifier_authority[6];
+       /* Size of the access control entry, including this header  */
+       le16 size;
+} __attribute__((packed)) wimlib_ACE_HEADER;
 
-       le32 sub_authority[];
-} _packed_attribute wimlib_SID;
+/* Windows NT access control entry to grant rights to a user or group  */
+typedef struct {
+       wimlib_ACE_HEADER hdr;
+       le32 mask;
+       wimlib_SID sid;
+} __attribute__((packed)) wimlib_ACCESS_ALLOWED_ACE;
+
+/* Windows NT access control entry to deny rights to a user or group  */
+typedef struct {
+       wimlib_ACE_HEADER hdr;
+       le32 mask;
+       wimlib_SID sid;
+} __attribute__((packed)) wimlib_ACCESS_DENIED_ACE;
+
+/* Windows NT access control entry to audit access to the object  */
+typedef struct {
+       wimlib_ACE_HEADER hdr;
+       le32 mask;
+       wimlib_SID sid;
+} __attribute__((packed)) wimlib_SYSTEM_AUDIT_ACE;
 
-#endif
+#endif /* _WIMLIB_SECURITY_DESCRIPTOR_H */