aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsacl.c19
-rw-r--r--fs/cifs/cifsacl.h9
-rw-r--r--fs/cifs/cifspdu.h6
3 files changed, 25 insertions, 9 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index c46f26bcd8b2..ecd6da9e9d38 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -95,23 +95,24 @@ int match_sid(struct cifs_sid *ctsid)
95 return (-1); 95 return (-1);
96} 96}
97 97
98 98/* if the two SIDs (roughly equivalent to a UUID for a user or group) are
99 the same returns 1, if they do not match returns 0 */
99int compare_sids(struct cifs_sid *ctsid, struct cifs_sid *cwsid) 100int compare_sids(struct cifs_sid *ctsid, struct cifs_sid *cwsid)
100{ 101{
101 int i; 102 int i;
102 int num_subauth, num_sat, num_saw; 103 int num_subauth, num_sat, num_saw;
103 104
104 if ((!ctsid) || (!cwsid)) 105 if ((!ctsid) || (!cwsid))
105 return (-1); 106 return (0);
106 107
107 /* compare the revision */ 108 /* compare the revision */
108 if (ctsid->revision != cwsid->revision) 109 if (ctsid->revision != cwsid->revision)
109 return (-1); 110 return (0);
110 111
111 /* compare all of the six auth values */ 112 /* compare all of the six auth values */
112 for (i = 0; i < 6; ++i) { 113 for (i = 0; i < 6; ++i) {
113 if (ctsid->authority[i] != cwsid->authority[i]) 114 if (ctsid->authority[i] != cwsid->authority[i])
114 return (-1); 115 return (0);
115 } 116 }
116 117
117 /* compare all of the subauth values if any */ 118 /* compare all of the subauth values if any */
@@ -121,11 +122,11 @@ int compare_sids(struct cifs_sid *ctsid, struct cifs_sid *cwsid)
121 if (num_subauth) { 122 if (num_subauth) {
122 for (i = 0; i < num_subauth; ++i) { 123 for (i = 0; i < num_subauth; ++i) {
123 if (ctsid->sub_auth[i] != cwsid->sub_auth[i]) 124 if (ctsid->sub_auth[i] != cwsid->sub_auth[i])
124 return (-1); 125 return (0);
125 } 126 }
126 } 127 }
127 128
128 return (0); /* sids compare/match */ 129 return (1); /* sids compare/match */
129} 130}
130 131
131 132
@@ -180,7 +181,8 @@ static void parse_ntace(struct cifs_ntace *pntace, char *end_of_acl)
180 181
181 182
182 183
183static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl) 184static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
185 struct cifs_sid *pownersid, struct cifs_sid pgrpsid)
184{ 186{
185 int i; 187 int i;
186 int num_aces = 0; 188 int num_aces = 0;
@@ -219,7 +221,6 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl)
219 cifscred->aces = kmalloc(num_aces * 221 cifscred->aces = kmalloc(num_aces *
220 sizeof(struct cifs_ace *), GFP_KERNEL);*/ 222 sizeof(struct cifs_ace *), GFP_KERNEL);*/
221 223
222
223 for (i = 0; i < num_aces; ++i) { 224 for (i = 0; i < num_aces; ++i) {
224 ppntace[i] = (struct cifs_ntace *) 225 ppntace[i] = (struct cifs_ntace *)
225 (acl_base + acl_size); 226 (acl_base + acl_size);
@@ -317,7 +318,7 @@ int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len)
317 if (rc) 318 if (rc)
318 return rc; 319 return rc;
319 320
320 parse_dacl(dacl_ptr, end_of_acl); 321 parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr, group_sid_ptr);
321 322
322/* cifscred->uid = owner_sid_ptr->rid; 323/* cifscred->uid = owner_sid_ptr->rid;
323 cifscred->gid = group_sid_ptr->rid; 324 cifscred->gid = group_sid_ptr->rid;
diff --git a/fs/cifs/cifsacl.h b/fs/cifs/cifsacl.h
index fa01053fc5fa..420f87813647 100644
--- a/fs/cifs/cifsacl.h
+++ b/fs/cifs/cifsacl.h
@@ -23,9 +23,18 @@
23#define _CIFSACL_H 23#define _CIFSACL_H
24 24
25 25
26#define NUM_AUTHS 6 /* number of authority fields */
27#define NUM_SUBAUTHS 5 /* number of sub authority fields */
26#define NUM_WK_SIDS 7 /* number of well known sids */ 28#define NUM_WK_SIDS 7 /* number of well known sids */
27#define SIDNAMELENGTH 20 /* long enough for the ones we care about */ 29#define SIDNAMELENGTH 20 /* long enough for the ones we care about */
28 30
31#define READ_BIT 0x4
32#define WRITE_BIT 0x2
33#define EXEC_BIT 0x1
34
35#define UBITSHIFT 6
36#define GBITSHIFT 3
37
29struct cifs_ntsd { 38struct cifs_ntsd {
30 __le16 revision; /* revision level */ 39 __le16 revision; /* revision level */
31 __le16 type; 40 __le16 type;
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index d2f0cf23bbba..c41ff74e9128 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -215,6 +215,12 @@
215 /* file_execute, file_read_attributes*/ 215 /* file_execute, file_read_attributes*/
216 /* write_dac, and delete. */ 216 /* write_dac, and delete. */
217 217
218#define FILE_READ_RIGHTS (FILE_READ_DATA | FILE_READ_EA | FILE_READ_ATTRIBUTES)
219#define FILE_WRITE_RIGHTS (FILE_WRITE_DATA | FILE_APPEND_DATA \
220 | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES)
221#define FILE_EXEC_RIGHTS (FILE_EXECUTE)
222
223
218/* 224/*
219 * Invalid readdir handle 225 * Invalid readdir handle
220 */ 226 */