diff options
author | Steve French <sfrench@us.ibm.com> | 2007-10-16 14:40:37 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-10-16 14:40:37 -0400 |
commit | af6f4612fdfd782c6d35272836a2b97e7e5b790e (patch) | |
tree | 6456435d2c845c43b0094473c6248ab59e7284b3 /fs/cifs/cifsacl.c | |
parent | 016ec75f1a0c0e765fce65d794569979104f031d (diff) |
[CIFS] Fix some endianness problems in new acl code
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsacl.c')
-rw-r--r-- | fs/cifs/cifsacl.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 601587724f9d..4735e9b47590 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 32 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
33 | 33 | ||
34 | struct cifs_wksid wksidarr[NUM_WK_SIDS] = { | 34 | static struct cifs_wksid wksidarr[NUM_WK_SIDS] = { |
35 | {{1, 0, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, "null user"}, | 35 | {{1, 0, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, "null user"}, |
36 | {{1, 1, {0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0} }, "nobody"}, | 36 | {{1, 1, {0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0} }, "nobody"}, |
37 | {{1, 1, {0, 0, 0, 0, 0, 5}, {11, 0, 0, 0, 0} }, "net-users"}, | 37 | {{1, 1, {0, 0, 0, 0, 0, 5}, {11, 0, 0, 0, 0} }, "net-users"}, |
@@ -192,14 +192,15 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl) | |||
192 | /* BB need to add parm so we can store the SID BB */ | 192 | /* BB need to add parm so we can store the SID BB */ |
193 | 193 | ||
194 | /* validate that we do not go past end of acl */ | 194 | /* validate that we do not go past end of acl */ |
195 | if (end_of_acl < (char *)pdacl + pdacl->size) { | 195 | if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) { |
196 | cERROR(1, ("ACL too small to parse DACL")); | 196 | cERROR(1, ("ACL too small to parse DACL")); |
197 | return; | 197 | return; |
198 | } | 198 | } |
199 | 199 | ||
200 | #ifdef CONFIG_CIFS_DEBUG2 | 200 | #ifdef CONFIG_CIFS_DEBUG2 |
201 | cFYI(1, ("DACL revision %d size %d num aces %d", | 201 | cFYI(1, ("DACL revision %d size %d num aces %d", |
202 | pdacl->revision, pdacl->size, pdacl->num_aces)); | 202 | le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size), |
203 | le32_to_cpu(pdacl->num_aces))); | ||
203 | #endif | 204 | #endif |
204 | 205 | ||
205 | acl_base = (char *)pdacl; | 206 | acl_base = (char *)pdacl; |
@@ -255,7 +256,6 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl) | |||
255 | 256 | ||
256 | static int parse_sid(struct cifs_sid *psid, char *end_of_acl) | 257 | static int parse_sid(struct cifs_sid *psid, char *end_of_acl) |
257 | { | 258 | { |
258 | int num_subauth; | ||
259 | 259 | ||
260 | /* BB need to add parm so we can store the SID BB */ | 260 | /* BB need to add parm so we can store the SID BB */ |
261 | 261 | ||
@@ -265,14 +265,13 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl) | |||
265 | return -EINVAL; | 265 | return -EINVAL; |
266 | } | 266 | } |
267 | 267 | ||
268 | num_subauth = cpu_to_le32(psid->num_subauth); | 268 | if (psid->num_subauth) { |
269 | if (num_subauth) { | ||
270 | #ifdef CONFIG_CIFS_DEBUG2 | 269 | #ifdef CONFIG_CIFS_DEBUG2 |
271 | int i; | 270 | int i; |
272 | cFYI(1, ("SID revision %d num_auth %d First subauth 0x%x", | 271 | cFYI(1, ("SID revision %d num_auth %d First subauth 0x%x", |
273 | psid->revision, psid->num_subauth, psid->sub_auth[0])); | 272 | psid->revision, psid->num_subauth, psid->sub_auth[0])); |
274 | 273 | ||
275 | for (i = 0; i < num_subauth; ++i) { | 274 | for (i = 0; i < psid->num_subauth; i++) { |
276 | cFYI(1, ("SID sub_auth[%d]: 0x%x ", i, | 275 | cFYI(1, ("SID sub_auth[%d]: 0x%x ", i, |
277 | le32_to_cpu(psid->sub_auth[i]))); | 276 | le32_to_cpu(psid->sub_auth[i]))); |
278 | } | 277 | } |
@@ -280,7 +279,7 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl) | |||
280 | /* BB add length check to make sure that we do not have huge | 279 | /* BB add length check to make sure that we do not have huge |
281 | num auths and therefore go off the end */ | 280 | num auths and therefore go off the end */ |
282 | cFYI(1, ("RID 0x%x", | 281 | cFYI(1, ("RID 0x%x", |
283 | le32_to_cpu(psid->sub_auth[num_subauth-1]))); | 282 | le32_to_cpu(psid->sub_auth[psid->num_subauth-1]))); |
284 | #endif | 283 | #endif |
285 | } | 284 | } |
286 | 285 | ||
@@ -297,17 +296,18 @@ int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len) | |||
297 | char *end_of_acl = ((char *)pntsd) + acl_len; | 296 | char *end_of_acl = ((char *)pntsd) + acl_len; |
298 | 297 | ||
299 | owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + | 298 | owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + |
300 | cpu_to_le32(pntsd->osidoffset)); | 299 | le32_to_cpu(pntsd->osidoffset)); |
301 | group_sid_ptr = (struct cifs_sid *)((char *)pntsd + | 300 | group_sid_ptr = (struct cifs_sid *)((char *)pntsd + |
302 | cpu_to_le32(pntsd->gsidoffset)); | 301 | le32_to_cpu(pntsd->gsidoffset)); |
303 | dacl_ptr = (struct cifs_acl *)((char *)pntsd + | 302 | dacl_ptr = (struct cifs_acl *)((char *)pntsd + |
304 | cpu_to_le32(pntsd->dacloffset)); | 303 | le32_to_cpu(pntsd->dacloffset)); |
305 | #ifdef CONFIG_CIFS_DEBUG2 | 304 | #ifdef CONFIG_CIFS_DEBUG2 |
306 | cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " | 305 | cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " |
307 | "sacloffset 0x%x dacloffset 0x%x", | 306 | "sacloffset 0x%x dacloffset 0x%x", |
308 | pntsd->revision, pntsd->type, | 307 | pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), |
309 | pntsd->osidoffset, pntsd->gsidoffset, pntsd->sacloffset, | 308 | le32_to_cpu(pntsd->gsidoffset), |
310 | pntsd->dacloffset)); | 309 | le32_to_cpu(pntsd->sacloffset), |
310 | le32_to_cpu(pntsd->dacloffset)); | ||
311 | #endif | 311 | #endif |
312 | rc = parse_sid(owner_sid_ptr, end_of_acl); | 312 | rc = parse_sid(owner_sid_ptr, end_of_acl); |
313 | if (rc) | 313 | if (rc) |