diff options
author | Steve French <sfrench@us.ibm.com> | 2007-11-05 16:46:10 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-11-05 16:46:10 -0500 |
commit | 63d2583f5a1a0b72fea3f2171f23f0ca8fa556ec (patch) | |
tree | b9dab1514976c462f2d3528f86dd6c3e46fca745 /fs | |
parent | f1d662a7d5e5322e583aad6b3cfec03d8f27b435 (diff) |
[CIFS] Fix walking out end of cifs dacl
Acked-by: Shirish Pargaonkar <shirishp@us.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifsacl.c | 4 | ||||
-rw-r--r-- | fs/cifs/cifsacl.h | 3 | ||||
-rw-r--r-- | fs/cifs/cifsencrypt.c | 4 | ||||
-rw-r--r-- | fs/cifs/netmisc.c | 2 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 2 | ||||
-rw-r--r-- | fs/cifs/smbencrypt.c | 14 | ||||
-rw-r--r-- | fs/cifs/xattr.c | 4 |
7 files changed, 19 insertions, 14 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index bd75a3b8caff..38d09fa8c1e6 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
@@ -327,7 +327,7 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len, | |||
327 | group_sid_ptr = (struct cifs_sid *)((char *)pntsd + | 327 | group_sid_ptr = (struct cifs_sid *)((char *)pntsd + |
328 | le32_to_cpu(pntsd->gsidoffset)); | 328 | le32_to_cpu(pntsd->gsidoffset)); |
329 | dacloffset = le32_to_cpu(pntsd->dacloffset); | 329 | dacloffset = le32_to_cpu(pntsd->dacloffset); |
330 | dacl_ptr = (struct cifs_acl *)(char *)pntsd + dacloffset; | 330 | dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset); |
331 | #ifdef CONFIG_CIFS_DEBUG2 | 331 | #ifdef CONFIG_CIFS_DEBUG2 |
332 | cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " | 332 | cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " |
333 | "sacloffset 0x%x dacloffset 0x%x", | 333 | "sacloffset 0x%x dacloffset 0x%x", |
@@ -346,7 +346,7 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len, | |||
346 | 346 | ||
347 | if (dacloffset) | 347 | if (dacloffset) |
348 | parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr, | 348 | parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr, |
349 | group_sid_ptr, inode); | 349 | group_sid_ptr, inode); |
350 | else | 350 | else |
351 | cFYI(1, ("no ACL")); /* BB grant all or default perms? */ | 351 | cFYI(1, ("no ACL")); /* BB grant all or default perms? */ |
352 | 352 | ||
diff --git a/fs/cifs/cifsacl.h b/fs/cifs/cifsacl.h index 30b0caf66786..93a7c3462ea2 100644 --- a/fs/cifs/cifsacl.h +++ b/fs/cifs/cifsacl.h | |||
@@ -35,6 +35,9 @@ | |||
35 | #define UBITSHIFT 6 | 35 | #define UBITSHIFT 6 |
36 | #define GBITSHIFT 3 | 36 | #define GBITSHIFT 3 |
37 | 37 | ||
38 | #define ACCESS_ALLOWED 0 | ||
39 | #define ACCESS_DENIED 1 | ||
40 | |||
38 | struct cifs_ntsd { | 41 | struct cifs_ntsd { |
39 | __le16 revision; /* revision level */ | 42 | __le16 revision; /* revision level */ |
40 | __le16 type; | 43 | __le16 type; |
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 788f0ad6feda..4ff8939c6cc7 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -108,7 +108,7 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec, | |||
108 | /* The first entry includes a length field (which does not get | 108 | /* The first entry includes a length field (which does not get |
109 | signed that occupies the first 4 bytes before the header */ | 109 | signed that occupies the first 4 bytes before the header */ |
110 | if (i == 0) { | 110 | if (i == 0) { |
111 | if (iov[0].iov_len <= 8 ) /* cmd field at offset 9 */ | 111 | if (iov[0].iov_len <= 8) /* cmd field at offset 9 */ |
112 | break; /* nothing to sign or corrupt header */ | 112 | break; /* nothing to sign or corrupt header */ |
113 | MD5Update(&context, iov[0].iov_base+4, | 113 | MD5Update(&context, iov[0].iov_base+4, |
114 | iov[0].iov_len-4); | 114 | iov[0].iov_len-4); |
@@ -123,7 +123,7 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec, | |||
123 | 123 | ||
124 | 124 | ||
125 | int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, | 125 | int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, |
126 | __u32 * pexpected_response_sequence_number) | 126 | __u32 *pexpected_response_sequence_number) |
127 | { | 127 | { |
128 | int rc = 0; | 128 | int rc = 0; |
129 | char smb_signature[20]; | 129 | char smb_signature[20]; |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index e1704da43836..646e1f06941b 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -770,7 +770,7 @@ cifs_print_status(__u32 status_code) | |||
770 | 770 | ||
771 | 771 | ||
772 | static void | 772 | static void |
773 | ntstatus_to_dos(__u32 ntstatus, __u8 * eclass, __u16 * ecode) | 773 | ntstatus_to_dos(__u32 ntstatus, __u8 *eclass, __u16 *ecode) |
774 | { | 774 | { |
775 | int i; | 775 | int i; |
776 | if (ntstatus == 0) { | 776 | if (ntstatus == 0) { |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 3746580e9701..82497d47429a 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -495,7 +495,7 @@ ffirst_retry: | |||
495 | static int cifs_unicode_bytelen(char *str) | 495 | static int cifs_unicode_bytelen(char *str) |
496 | { | 496 | { |
497 | int len; | 497 | int len; |
498 | __le16 * ustr = (__le16 *)str; | 498 | __le16 *ustr = (__le16 *)str; |
499 | 499 | ||
500 | for (len = 0; len <= PATH_MAX; len++) { | 500 | for (len = 0; len <= PATH_MAX; len++) { |
501 | if (ustr[len] == 0) | 501 | if (ustr[len] == 0) |
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c index bd3c4674f2ba..58bbfd992cc0 100644 --- a/fs/cifs/smbencrypt.c +++ b/fs/cifs/smbencrypt.c | |||
@@ -80,7 +80,7 @@ SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) | |||
80 | 80 | ||
81 | /* Routines for Windows NT MD4 Hash functions. */ | 81 | /* Routines for Windows NT MD4 Hash functions. */ |
82 | static int | 82 | static int |
83 | _my_wcslen(__u16 * str) | 83 | _my_wcslen(__u16 *str) |
84 | { | 84 | { |
85 | int len = 0; | 85 | int len = 0; |
86 | while (*str++ != 0) | 86 | while (*str++ != 0) |
@@ -96,7 +96,7 @@ _my_wcslen(__u16 * str) | |||
96 | */ | 96 | */ |
97 | 97 | ||
98 | static int | 98 | static int |
99 | _my_mbstowcs(__u16 * dst, const unsigned char *src, int len) | 99 | _my_mbstowcs(__u16 *dst, const unsigned char *src, int len) |
100 | { /* BB not a very good conversion routine - change/fix */ | 100 | { /* BB not a very good conversion routine - change/fix */ |
101 | int i; | 101 | int i; |
102 | __u16 val; | 102 | __u16 val; |
@@ -125,9 +125,9 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16) | |||
125 | /* Password cannot be longer than 128 characters */ | 125 | /* Password cannot be longer than 128 characters */ |
126 | if (passwd) { | 126 | if (passwd) { |
127 | len = strlen((char *) passwd); | 127 | len = strlen((char *) passwd); |
128 | if (len > 128) { | 128 | if (len > 128) |
129 | len = 128; | 129 | len = 128; |
130 | } | 130 | |
131 | /* Password must be converted to NT unicode */ | 131 | /* Password must be converted to NT unicode */ |
132 | _my_mbstowcs(wpwd, passwd, len); | 132 | _my_mbstowcs(wpwd, passwd, len); |
133 | } else | 133 | } else |
@@ -189,8 +189,10 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n, | |||
189 | return; | 189 | return; |
190 | dom_u = user_u + 1024; | 190 | dom_u = user_u + 1024; |
191 | 191 | ||
192 | /* push_ucs2(NULL, user_u, user_n, (user_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); | 192 | /* push_ucs2(NULL, user_u, user_n, (user_l+1)*2, |
193 | push_ucs2(NULL, dom_u, domain_n, (domain_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); */ | 193 | STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); |
194 | push_ucs2(NULL, dom_u, domain_n, (domain_l+1)*2, | ||
195 | STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); */ | ||
194 | 196 | ||
195 | /* BB user and domain may need to be uppercased */ | 197 | /* BB user and domain may need to be uppercased */ |
196 | user_l = cifs_strtoUCS(user_u, user_n, 511, nls_codepage); | 198 | user_l = cifs_strtoUCS(user_u, user_n, 511, nls_codepage); |
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 12b125ff0bd0..54e8ef96cb79 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -267,7 +267,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
267 | int oplock = FALSE; | 267 | int oplock = FALSE; |
268 | struct cifs_ntsd *pacl = NULL; | 268 | struct cifs_ntsd *pacl = NULL; |
269 | __u32 buflen = 0; | 269 | __u32 buflen = 0; |
270 | if (experimEnabled) | 270 | if (experimEnabled) |
271 | rc = CIFSSMBOpen(xid, pTcon, full_path, | 271 | rc = CIFSSMBOpen(xid, pTcon, full_path, |
272 | FILE_OPEN, GENERIC_READ, 0, &fid, | 272 | FILE_OPEN, GENERIC_READ, 0, &fid, |
273 | &oplock, NULL, cifs_sb->local_nls, | 273 | &oplock, NULL, cifs_sb->local_nls, |
@@ -275,7 +275,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
275 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 275 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
276 | /* else rc is EOPNOTSUPP from above */ | 276 | /* else rc is EOPNOTSUPP from above */ |
277 | 277 | ||
278 | if(rc == 0) { | 278 | if (rc == 0) { |
279 | rc = CIFSSMBGetCIFSACL(xid, pTcon, fid, &pacl, | 279 | rc = CIFSSMBGetCIFSACL(xid, pTcon, fid, &pacl, |
280 | &buflen); | 280 | &buflen); |
281 | CIFSSMBClose(xid, pTcon, fid); | 281 | CIFSSMBClose(xid, pTcon, fid); |