0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _CIFSACL_H
0010 #define _CIFSACL_H
0011
0012 #define NUM_AUTHS (6)
0013 #define SID_MAX_SUB_AUTHORITIES (15)
0014
0015 #define READ_BIT 0x4
0016 #define WRITE_BIT 0x2
0017 #define EXEC_BIT 0x1
0018
0019 #define ACL_OWNER_MASK 0700
0020 #define ACL_GROUP_MASK 0070
0021 #define ACL_EVERYONE_MASK 0007
0022
0023 #define UBITSHIFT 6
0024 #define GBITSHIFT 3
0025
0026 #define ACCESS_ALLOWED 0
0027 #define ACCESS_DENIED 1
0028
0029 #define SIDOWNER 1
0030 #define SIDGROUP 2
0031
0032
0033
0034
0035
0036 #define DEFAULT_SEC_DESC_LEN (sizeof(struct cifs_ntsd) + \
0037 sizeof(struct cifs_acl) + \
0038 (sizeof(struct cifs_ace) * 4))
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 #define SID_STRING_BASE_SIZE (2 + 3 + 15 + 1)
0056 #define SID_STRING_SUBAUTH_SIZE (11)
0057
0058 struct cifs_ntsd {
0059 __le16 revision;
0060 __le16 type;
0061 __le32 osidoffset;
0062 __le32 gsidoffset;
0063 __le32 sacloffset;
0064 __le32 dacloffset;
0065 } __attribute__((packed));
0066
0067 struct cifs_sid {
0068 __u8 revision;
0069 __u8 num_subauth;
0070 __u8 authority[NUM_AUTHS];
0071 __le32 sub_auth[SID_MAX_SUB_AUTHORITIES];
0072 } __attribute__((packed));
0073
0074
0075 #define CIFS_SID_BASE_SIZE (1 + 1 + NUM_AUTHS)
0076
0077 struct cifs_acl {
0078 __le16 revision;
0079 __le16 size;
0080 __le32 num_aces;
0081 } __attribute__((packed));
0082
0083
0084 #define ACCESS_ALLOWED_ACE_TYPE 0x00
0085 #define ACCESS_DENIED_ACE_TYPE 0x01
0086 #define SYSTEM_AUDIT_ACE_TYPE 0x02
0087 #define SYSTEM_ALARM_ACE_TYPE 0x03
0088 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04
0089 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05
0090 #define ACCESS_DENIED_OBJECT_ACE_TYPE 0x06
0091 #define SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07
0092 #define SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08
0093 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09
0094 #define ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A
0095 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B
0096 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C
0097 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D
0098 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E
0099 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F
0100 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10
0101 #define SYSTEM_MANDATORY_LABEL_ACE_TYPE 0x11
0102 #define SYSTEM_RESOURCE_ATTRIBUTE_ACE_TYPE 0x12
0103 #define SYSTEM_SCOPED_POLICY_ID_ACE_TYPE 0x13
0104
0105
0106 #define OBJECT_INHERIT_ACE 0x01
0107 #define CONTAINER_INHERIT_ACE 0x02
0108 #define NO_PROPAGATE_INHERIT_ACE 0x04
0109 #define INHERIT_ONLY_ACE 0x08
0110 #define INHERITED_ACE 0x10
0111 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
0112 #define FAILED_ACCESS_ACE_FLAG 0x80
0113
0114 struct cifs_ace {
0115 __u8 type;
0116 __u8 flags;
0117 __le16 size;
0118 __le32 access_req;
0119 struct cifs_sid sid;
0120 } __attribute__((packed));
0121
0122
0123
0124
0125
0126
0127
0128
0129 struct smb3_sd {
0130 __u8 Revision;
0131 __u8 Sbz1;
0132 __le16 Control;
0133 __le32 OffsetOwner;
0134 __le32 OffsetGroup;
0135 __le32 OffsetSacl;
0136 __le32 OffsetDacl;
0137 } __packed;
0138
0139
0140 #define ACL_CONTROL_SR 0x8000
0141 #define ACL_CONTROL_RM 0x4000
0142 #define ACL_CONTROL_PS 0x2000
0143 #define ACL_CONTROL_PD 0x1000
0144 #define ACL_CONTROL_SI 0x0800
0145 #define ACL_CONTROL_DI 0x0400
0146 #define ACL_CONTROL_SC 0x0200
0147 #define ACL_CONTROL_DC 0x0100
0148 #define ACL_CONTROL_SS 0x0080
0149 #define ACL_CONTROL_DT 0x0040
0150 #define ACL_CONTROL_SD 0x0020
0151 #define ACL_CONTROL_SP 0x0010
0152 #define ACL_CONTROL_DD 0x0008
0153 #define ACL_CONTROL_DP 0x0004
0154 #define ACL_CONTROL_GD 0x0002
0155 #define ACL_CONTROL_OD 0x0001
0156
0157
0158 #define ACL_REVISION 0x02
0159 #define ACL_REVISION_DS 0x04
0160
0161 struct smb3_acl {
0162 u8 AclRevision;
0163 u8 Sbz1;
0164 __le16 AclSize;
0165 __le16 AceCount;
0166 __le16 Sbz2;
0167 } __packed;
0168
0169
0170
0171
0172
0173 struct owner_sid {
0174 u8 Revision;
0175 u8 NumAuth;
0176 u8 Authority[6];
0177 __le32 SubAuthorities[3];
0178 } __packed;
0179
0180 struct owner_group_sids {
0181 struct owner_sid owner;
0182 struct owner_sid group;
0183 } __packed;
0184
0185
0186
0187
0188
0189
0190
0191 #define MIN_SID_LEN (1 + 1 + 6 + 4)
0192
0193
0194
0195
0196
0197 #define MIN_SEC_DESC_LEN (sizeof(struct cifs_ntsd) + (2 * MIN_SID_LEN))
0198
0199 #endif