diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/CHANGES | 7 | ||||
-rw-r--r-- | fs/cifs/README | 12 | ||||
-rw-r--r-- | fs/cifs/cifs_debug.c | 12 | ||||
-rw-r--r-- | fs/cifs/cifsacl.h | 36 | ||||
-rw-r--r-- | fs/cifs/cifsencrypt.c | 55 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 6 | ||||
-rw-r--r-- | fs/cifs/cifsfs.h | 2 | ||||
-rw-r--r-- | fs/cifs/cifsglob.h | 8 | ||||
-rw-r--r-- | fs/cifs/cifspdu.h | 2 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 6 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 5 | ||||
-rw-r--r-- | fs/cifs/connect.c | 53 | ||||
-rw-r--r-- | fs/cifs/dir.c | 8 | ||||
-rw-r--r-- | fs/cifs/file.c | 6 | ||||
-rw-r--r-- | fs/cifs/inode.c | 4 | ||||
-rw-r--r-- | fs/cifs/misc.c | 15 | ||||
-rw-r--r-- | fs/cifs/transport.c | 19 |
17 files changed, 212 insertions, 44 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 943ef9b82244..1d2137561c55 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,3 +1,8 @@ | |||
1 | Version 1.40 | ||
2 | ------------ | ||
3 | Use fsuid (fsgid) more consistently instead of uid (gid). Improve performance | ||
4 | of readpages by eliminating one extra memcpy. | ||
5 | |||
1 | Version 1.39 | 6 | Version 1.39 |
2 | ------------ | 7 | ------------ |
3 | Defer close of a file handle slightly if pending writes depend on that handle | 8 | Defer close of a file handle slightly if pending writes depend on that handle |
@@ -7,6 +12,8 @@ Fix SFU style symlinks and mknod needed for servers which do not support the | |||
7 | CIFS Unix Extensions. Fix setfacl/getfacl on bigendian. Timeout negative | 12 | CIFS Unix Extensions. Fix setfacl/getfacl on bigendian. Timeout negative |
8 | dentries so files that the client sees as deleted but that later get created | 13 | dentries so files that the client sees as deleted but that later get created |
9 | on the server will be recognized. Add client side permission check on setattr. | 14 | on the server will be recognized. Add client side permission check on setattr. |
15 | Timeout stuck requests better (where server has never responded or sent corrupt | ||
16 | responses) | ||
10 | 17 | ||
11 | Version 1.38 | 18 | Version 1.38 |
12 | ------------ | 19 | ------------ |
diff --git a/fs/cifs/README b/fs/cifs/README index e5d09a2fc7a5..b0070d1b149d 100644 --- a/fs/cifs/README +++ b/fs/cifs/README | |||
@@ -436,7 +436,17 @@ A partial list of the supported mount options follows: | |||
436 | SFU does). In the future the bottom 9 bits of the mode | 436 | SFU does). In the future the bottom 9 bits of the mode |
437 | mode also will be emulated using queries of the security | 437 | mode also will be emulated using queries of the security |
438 | descriptor (ACL). | 438 | descriptor (ACL). |
439 | 439 | sec Security mode. Allowed values are: | |
440 | none attempt to connection as a null user (no name) | ||
441 | krb5 Use Kerberos version 5 authentication | ||
442 | krb5i Use Kerberos authentication and packet signing | ||
443 | ntlm Use NTLM password hashing (default) | ||
444 | ntlmi Use NTLM password hashing with signing (if | ||
445 | /proc/fs/cifs/PacketSigningEnabled on or if | ||
446 | server requires signing also can be the default) | ||
447 | ntlmv2 Use NTLMv2 password hashing | ||
448 | ntlmv2i Use NTLMv2 password hashing with packet signing | ||
449 | |||
440 | The mount.cifs mount helper also accepts a few mount options before -o | 450 | The mount.cifs mount helper also accepts a few mount options before -o |
441 | including: | 451 | including: |
442 | 452 | ||
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 22a444a3fe4c..6f5d81f5eacb 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c | |||
@@ -219,6 +219,10 @@ cifs_stats_write(struct file *file, const char __user *buffer, | |||
219 | 219 | ||
220 | if (c == '1' || c == 'y' || c == 'Y' || c == '0') { | 220 | if (c == '1' || c == 'y' || c == 'Y' || c == '0') { |
221 | read_lock(&GlobalSMBSeslock); | 221 | read_lock(&GlobalSMBSeslock); |
222 | #ifdef CONFIG_CIFS_STATS2 | ||
223 | atomic_set(&totBufAllocCount, 0); | ||
224 | atomic_set(&totSmBufAllocCount, 0); | ||
225 | #endif /* CONFIG_CIFS_STATS2 */ | ||
222 | list_for_each(tmp, &GlobalTreeConnectionList) { | 226 | list_for_each(tmp, &GlobalTreeConnectionList) { |
223 | tcon = list_entry(tmp, struct cifsTconInfo, | 227 | tcon = list_entry(tmp, struct cifsTconInfo, |
224 | cifsConnectionList); | 228 | cifsConnectionList); |
@@ -276,6 +280,14 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset, | |||
276 | smBufAllocCount.counter,cifs_min_small); | 280 | smBufAllocCount.counter,cifs_min_small); |
277 | length += item_length; | 281 | length += item_length; |
278 | buf += item_length; | 282 | buf += item_length; |
283 | #ifdef CONFIG_CIFS_STATS2 | ||
284 | item_length = sprintf(buf, "Total Large %d Small %d Allocations\n", | ||
285 | atomic_read(&totBufAllocCount), | ||
286 | atomic_read(&totSmBufAllocCount)); | ||
287 | length += item_length; | ||
288 | buf += item_length; | ||
289 | #endif /* CONFIG_CIFS_STATS2 */ | ||
290 | |||
279 | item_length = | 291 | item_length = |
280 | sprintf(buf,"Operations (MIDs): %d\n", | 292 | sprintf(buf,"Operations (MIDs): %d\n", |
281 | midCount.counter); | 293 | midCount.counter); |
diff --git a/fs/cifs/cifsacl.h b/fs/cifs/cifsacl.h new file mode 100644 index 000000000000..4cfcdf2e6304 --- /dev/null +++ b/fs/cifs/cifsacl.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * fs/cifs/cifsacl.h | ||
3 | * | ||
4 | * Copyright (c) International Business Machines Corp., 2005 | ||
5 | * Author(s): Steve French (sfrench@us.ibm.com) | ||
6 | * | ||
7 | * This library is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU Lesser General Public License as published | ||
9 | * by the Free Software Foundation; either version 2.1 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This library is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
15 | * the GNU Lesser General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public License | ||
18 | * along with this library; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #ifndef _CIFSACL_H | ||
23 | #define _CIFSACL_H | ||
24 | |||
25 | struct cifs_sid { | ||
26 | __u8 revision; /* revision level */ | ||
27 | __u8 num_subauths; | ||
28 | __u8 authority[6]; | ||
29 | __u8 sub_auth[4]; | ||
30 | /* next sub_auth if any ... */ | ||
31 | } __attribute__((packed)); | ||
32 | |||
33 | /* everyone */ | ||
34 | const cifs_sid sid_everyone = {1, 1, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0}}; | ||
35 | /* group users */ | ||
36 | const cifs_sid sid_user = {1, 2 , {0, 0, 0, 0, 0, 5}, {32, 545, 0, 0}}; | ||
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index fe2bb7c4c912..a2c24858d40f 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/cifsencrypt.c | 2 | * fs/cifs/cifsencrypt.c |
3 | * | 3 | * |
4 | * Copyright (C) International Business Machines Corp., 2003 | 4 | * Copyright (C) International Business Machines Corp., 2005 |
5 | * Author(s): Steve French (sfrench@us.ibm.com) | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
6 | * | 6 | * |
7 | * This library is free software; you can redistribute it and/or modify | 7 | * This library is free software; you can redistribute it and/or modify |
@@ -82,6 +82,59 @@ int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct TCP_Server_Info * server, | |||
82 | return rc; | 82 | return rc; |
83 | } | 83 | } |
84 | 84 | ||
85 | static int cifs_calc_signature2(const struct kvec * iov, int n_vec, | ||
86 | const char * key, char * signature) | ||
87 | { | ||
88 | struct MD5Context context; | ||
89 | |||
90 | if((iov == NULL) || (signature == NULL)) | ||
91 | return -EINVAL; | ||
92 | |||
93 | MD5Init(&context); | ||
94 | MD5Update(&context,key,CIFS_SESSION_KEY_SIZE+16); | ||
95 | |||
96 | /* MD5Update(&context,cifs_pdu->Protocol,cifs_pdu->smb_buf_length); */ /* BB FIXME BB */ | ||
97 | |||
98 | MD5Final(signature,&context); | ||
99 | |||
100 | return -EOPNOTSUPP; | ||
101 | /* return 0; */ | ||
102 | } | ||
103 | |||
104 | |||
105 | int cifs_sign_smb2(struct kvec * iov, int n_vec, struct TCP_Server_Info *server, | ||
106 | __u32 * pexpected_response_sequence_number) | ||
107 | { | ||
108 | int rc = 0; | ||
109 | char smb_signature[20]; | ||
110 | struct smb_hdr * cifs_pdu = iov[0].iov_base; | ||
111 | |||
112 | if((cifs_pdu == NULL) || (server == NULL)) | ||
113 | return -EINVAL; | ||
114 | |||
115 | if((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) | ||
116 | return rc; | ||
117 | |||
118 | spin_lock(&GlobalMid_Lock); | ||
119 | cifs_pdu->Signature.Sequence.SequenceNumber = | ||
120 | cpu_to_le32(server->sequence_number); | ||
121 | cifs_pdu->Signature.Sequence.Reserved = 0; | ||
122 | |||
123 | *pexpected_response_sequence_number = server->sequence_number++; | ||
124 | server->sequence_number++; | ||
125 | spin_unlock(&GlobalMid_Lock); | ||
126 | |||
127 | rc = cifs_calc_signature2(iov, n_vec, server->mac_signing_key, | ||
128 | smb_signature); | ||
129 | if(rc) | ||
130 | memset(cifs_pdu->Signature.SecuritySignature, 0, 8); | ||
131 | else | ||
132 | memcpy(cifs_pdu->Signature.SecuritySignature, smb_signature, 8); | ||
133 | |||
134 | return rc; | ||
135 | |||
136 | } | ||
137 | |||
85 | int cifs_verify_signature(struct smb_hdr * cifs_pdu, const char * mac_key, | 138 | int cifs_verify_signature(struct smb_hdr * cifs_pdu, const char * mac_key, |
86 | __u32 expected_sequence_number) | 139 | __u32 expected_sequence_number) |
87 | { | 140 | { |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 2a13a2bac8f1..ba90903909a6 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -954,6 +954,12 @@ init_cifs(void) | |||
954 | atomic_set(&tconInfoReconnectCount, 0); | 954 | atomic_set(&tconInfoReconnectCount, 0); |
955 | 955 | ||
956 | atomic_set(&bufAllocCount, 0); | 956 | atomic_set(&bufAllocCount, 0); |
957 | atomic_set(&smBufAllocCount, 0); | ||
958 | #ifdef CONFIG_CIFS_STATS2 | ||
959 | atomic_set(&totBufAllocCount, 0); | ||
960 | atomic_set(&totSmBufAllocCount, 0); | ||
961 | #endif /* CONFIG_CIFS_STATS2 */ | ||
962 | |||
957 | atomic_set(&midCount, 0); | 963 | atomic_set(&midCount, 0); |
958 | GlobalCurrentXid = 0; | 964 | GlobalCurrentXid = 0; |
959 | GlobalTotalActiveXid = 0; | 965 | GlobalTotalActiveXid = 0; |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 9ec40e0e54fc..821a8eb22559 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -99,5 +99,5 @@ extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); | |||
99 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); | 99 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); |
100 | extern int cifs_ioctl (struct inode * inode, struct file * filep, | 100 | extern int cifs_ioctl (struct inode * inode, struct file * filep, |
101 | unsigned int command, unsigned long arg); | 101 | unsigned int command, unsigned long arg); |
102 | #define CIFS_VERSION "1.39" | 102 | #define CIFS_VERSION "1.40" |
103 | #endif /* _CIFSFS_H */ | 103 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 1ba08f8c5bc4..c011c278af4c 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -505,8 +505,12 @@ GLOBAL_EXTERN atomic_t tcpSesReconnectCount; | |||
505 | GLOBAL_EXTERN atomic_t tconInfoReconnectCount; | 505 | GLOBAL_EXTERN atomic_t tconInfoReconnectCount; |
506 | 506 | ||
507 | /* Various Debug counters to remove someday (BB) */ | 507 | /* Various Debug counters to remove someday (BB) */ |
508 | GLOBAL_EXTERN atomic_t bufAllocCount; | 508 | GLOBAL_EXTERN atomic_t bufAllocCount; /* current number allocated */ |
509 | GLOBAL_EXTERN atomic_t smBufAllocCount; | 509 | #ifdef CONFIG_CIFS_STATS2 |
510 | GLOBAL_EXTERN atomic_t totBufAllocCount; /* total allocated over all time */ | ||
511 | GLOBAL_EXTERN atomic_t totSmBufAllocCount; | ||
512 | #endif | ||
513 | GLOBAL_EXTERN atomic_t smBufAllocCount; | ||
510 | GLOBAL_EXTERN atomic_t midCount; | 514 | GLOBAL_EXTERN atomic_t midCount; |
511 | 515 | ||
512 | /* Misc globals */ | 516 | /* Misc globals */ |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 33e1859fd2f6..5253e779b3aa 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/cifspdu.h | 2 | * fs/cifs/cifspdu.h |
3 | * | 3 | * |
4 | * Copyright (c) International Business Machines Corp., 2002 | 4 | * Copyright (c) International Business Machines Corp., 2002,2005 |
5 | * Author(s): Steve French (sfrench@us.ibm.com) | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
6 | * | 6 | * |
7 | * This library is free software; you can redistribute it and/or modify | 7 | * This library is free software; you can redistribute it and/or modify |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 1b73f4f4c5ce..c058f8a45b2b 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -48,7 +48,7 @@ extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, | |||
48 | struct smb_hdr * /* out */ , | 48 | struct smb_hdr * /* out */ , |
49 | int * /* bytes returned */ , const int long_op); | 49 | int * /* bytes returned */ , const int long_op); |
50 | extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *, | 50 | extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *, |
51 | struct kvec *, int /* nvec */, | 51 | struct kvec *, int /* nvec to send */, |
52 | int * /* bytes returned */ , const int long_op); | 52 | int * /* bytes returned */ , const int long_op); |
53 | extern int checkSMBhdr(struct smb_hdr *smb, __u16 mid); | 53 | extern int checkSMBhdr(struct smb_hdr *smb, __u16 mid); |
54 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, int length); | 54 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, int length); |
@@ -237,12 +237,10 @@ extern int CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, | |||
237 | const __u64 lseek, unsigned int *nbytes, | 237 | const __u64 lseek, unsigned int *nbytes, |
238 | const char *buf, const char __user *ubuf, | 238 | const char *buf, const char __user *ubuf, |
239 | const int long_op); | 239 | const int long_op); |
240 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
241 | extern int CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, | 240 | extern int CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, |
242 | const int netfid, const unsigned int count, | 241 | const int netfid, const unsigned int count, |
243 | const __u64 offset, unsigned int *nbytes, | 242 | const __u64 offset, unsigned int *nbytes, |
244 | struct kvec *iov, const int nvec, const int long_op); | 243 | struct kvec *iov, const int nvec, const int long_op); |
245 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | ||
246 | extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, | 244 | extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, |
247 | const unsigned char *searchName, __u64 * inode_number, | 245 | const unsigned char *searchName, __u64 * inode_number, |
248 | const struct nls_table *nls_codepage, | 246 | const struct nls_table *nls_codepage, |
@@ -269,6 +267,8 @@ extern void tconInfoFree(struct cifsTconInfo *); | |||
269 | extern int cifs_reconnect(struct TCP_Server_Info *server); | 267 | extern int cifs_reconnect(struct TCP_Server_Info *server); |
270 | 268 | ||
271 | extern int cifs_sign_smb(struct smb_hdr *, struct TCP_Server_Info *,__u32 *); | 269 | extern int cifs_sign_smb(struct smb_hdr *, struct TCP_Server_Info *,__u32 *); |
270 | extern int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *, | ||
271 | __u32 *); | ||
272 | extern int cifs_verify_signature(struct smb_hdr *, const char * mac_key, | 272 | extern int cifs_verify_signature(struct smb_hdr *, const char * mac_key, |
273 | __u32 expected_sequence_number); | 273 | __u32 expected_sequence_number); |
274 | extern int cifs_calculate_mac_key(char * key,const char * rn,const char * pass); | 274 | extern int cifs_calculate_mac_key(char * key,const char * rn,const char * pass); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 6867e556d37e..3565d3bf2e32 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1155,7 +1155,6 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, | |||
1155 | return rc; | 1155 | return rc; |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
1159 | int | 1158 | int |
1160 | CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, | 1159 | CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, |
1161 | const int netfid, const unsigned int count, | 1160 | const int netfid, const unsigned int count, |
@@ -1223,7 +1222,7 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, | |||
1223 | *nbytes = le16_to_cpu(pSMBr->CountHigh); | 1222 | *nbytes = le16_to_cpu(pSMBr->CountHigh); |
1224 | *nbytes = (*nbytes) << 16; | 1223 | *nbytes = (*nbytes) << 16; |
1225 | *nbytes += le16_to_cpu(pSMBr->Count); | 1224 | *nbytes += le16_to_cpu(pSMBr->Count); |
1226 | } | 1225 | } |
1227 | 1226 | ||
1228 | cifs_small_buf_release(pSMB); | 1227 | cifs_small_buf_release(pSMB); |
1229 | 1228 | ||
@@ -1234,8 +1233,6 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, | |||
1234 | } | 1233 | } |
1235 | 1234 | ||
1236 | 1235 | ||
1237 | #endif /* CIFS_EXPERIMENTAL */ | ||
1238 | |||
1239 | int | 1236 | int |
1240 | CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | 1237 | CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, |
1241 | const __u16 smb_file_id, const __u64 len, | 1238 | const __u16 smb_file_id, const __u64 len, |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index c467de857610..651f3b6cebed 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -82,6 +82,12 @@ struct smb_vol { | |||
82 | unsigned remap:1; /* set to remap seven reserved chars in filenames */ | 82 | unsigned remap:1; /* set to remap seven reserved chars in filenames */ |
83 | unsigned posix_paths:1; /* unset to not ask for posix pathnames. */ | 83 | unsigned posix_paths:1; /* unset to not ask for posix pathnames. */ |
84 | unsigned sfu_emul:1; | 84 | unsigned sfu_emul:1; |
85 | unsigned krb5:1; | ||
86 | unsigned ntlm:1; | ||
87 | unsigned ntlmv2:1; | ||
88 | unsigned nullauth:1; /* attempt to authenticate with null user */ | ||
89 | unsigned sign:1; | ||
90 | unsigned seal:1; /* encrypt */ | ||
85 | unsigned nocase; /* request case insensitive filenames */ | 91 | unsigned nocase; /* request case insensitive filenames */ |
86 | unsigned nobrl; /* disable sending byte range locks to srv */ | 92 | unsigned nobrl; /* disable sending byte range locks to srv */ |
87 | unsigned int rsize; | 93 | unsigned int rsize; |
@@ -777,7 +783,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
777 | 783 | ||
778 | /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ | 784 | /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ |
779 | vol->rw = TRUE; | 785 | vol->rw = TRUE; |
780 | 786 | vol->ntlm = TRUE; | |
781 | /* default is always to request posix paths. */ | 787 | /* default is always to request posix paths. */ |
782 | vol->posix_paths = 1; | 788 | vol->posix_paths = 1; |
783 | 789 | ||
@@ -903,6 +909,39 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
903 | printk(KERN_WARNING "CIFS: ip address too long\n"); | 909 | printk(KERN_WARNING "CIFS: ip address too long\n"); |
904 | return 1; | 910 | return 1; |
905 | } | 911 | } |
912 | } else if (strnicmp(data, "sec", 3) == 0) { | ||
913 | if (!value || !*value) { | ||
914 | cERROR(1,("no security value specified")); | ||
915 | continue; | ||
916 | } else if (strnicmp(value, "krb5i", 5) == 0) { | ||
917 | vol->sign = 1; | ||
918 | vol->krb5 = 1; | ||
919 | } else if (strnicmp(value, "krb5p", 5) == 0) { | ||
920 | /* vol->seal = 1; | ||
921 | vol->krb5 = 1; */ | ||
922 | cERROR(1,("Krb5 cifs privacy not supported")); | ||
923 | return 1; | ||
924 | } else if (strnicmp(value, "krb5", 4) == 0) { | ||
925 | vol->krb5 = 1; | ||
926 | } else if (strnicmp(value, "ntlmv2i", 7) == 0) { | ||
927 | vol->ntlmv2 = 1; | ||
928 | vol->sign = 1; | ||
929 | } else if (strnicmp(value, "ntlmv2", 6) == 0) { | ||
930 | vol->ntlmv2 = 1; | ||
931 | } else if (strnicmp(value, "ntlmi", 5) == 0) { | ||
932 | vol->ntlm = 1; | ||
933 | vol->sign = 1; | ||
934 | } else if (strnicmp(value, "ntlm", 4) == 0) { | ||
935 | /* ntlm is default so can be turned off too */ | ||
936 | vol->ntlm = 1; | ||
937 | } else if (strnicmp(value, "nontlm", 6) == 0) { | ||
938 | vol->ntlm = 0; | ||
939 | } else if (strnicmp(value, "none", 4) == 0) { | ||
940 | vol->nullauth = 1; | ||
941 | } else { | ||
942 | cERROR(1,("bad security option: %s", value)); | ||
943 | return 1; | ||
944 | } | ||
906 | } else if ((strnicmp(data, "unc", 3) == 0) | 945 | } else if ((strnicmp(data, "unc", 3) == 0) |
907 | || (strnicmp(data, "target", 6) == 0) | 946 | || (strnicmp(data, "target", 6) == 0) |
908 | || (strnicmp(data, "path", 4) == 0)) { | 947 | || (strnicmp(data, "path", 4) == 0)) { |
@@ -1546,7 +1585,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1546 | cFYI(1, ("Username: %s ", volume_info.username)); | 1585 | cFYI(1, ("Username: %s ", volume_info.username)); |
1547 | 1586 | ||
1548 | } else { | 1587 | } else { |
1549 | cifserror("No username specified "); | 1588 | cifserror("No username specified"); |
1550 | /* In userspace mount helper we can get user name from alternate | 1589 | /* In userspace mount helper we can get user name from alternate |
1551 | locations such as env variables and files on disk */ | 1590 | locations such as env variables and files on disk */ |
1552 | kfree(volume_info.UNC); | 1591 | kfree(volume_info.UNC); |
@@ -1587,7 +1626,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1587 | return -EINVAL; | 1626 | return -EINVAL; |
1588 | } else /* which servers DFS root would we conect to */ { | 1627 | } else /* which servers DFS root would we conect to */ { |
1589 | cERROR(1, | 1628 | cERROR(1, |
1590 | ("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified ")); | 1629 | ("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified")); |
1591 | kfree(volume_info.UNC); | 1630 | kfree(volume_info.UNC); |
1592 | kfree(volume_info.password); | 1631 | kfree(volume_info.password); |
1593 | FreeXid(xid); | 1632 | FreeXid(xid); |
@@ -1626,7 +1665,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1626 | 1665 | ||
1627 | 1666 | ||
1628 | if (srvTcp) { | 1667 | if (srvTcp) { |
1629 | cFYI(1, ("Existing tcp session with server found ")); | 1668 | cFYI(1, ("Existing tcp session with server found")); |
1630 | } else { /* create socket */ | 1669 | } else { /* create socket */ |
1631 | if(volume_info.port) | 1670 | if(volume_info.port) |
1632 | sin_server.sin_port = htons(volume_info.port); | 1671 | sin_server.sin_port = htons(volume_info.port); |
@@ -1689,11 +1728,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1689 | 1728 | ||
1690 | if (existingCifsSes) { | 1729 | if (existingCifsSes) { |
1691 | pSesInfo = existingCifsSes; | 1730 | pSesInfo = existingCifsSes; |
1692 | cFYI(1, ("Existing smb sess found ")); | 1731 | cFYI(1, ("Existing smb sess found")); |
1693 | kfree(volume_info.password); | 1732 | kfree(volume_info.password); |
1694 | /* volume_info.UNC freed at end of function */ | 1733 | /* volume_info.UNC freed at end of function */ |
1695 | } else if (!rc) { | 1734 | } else if (!rc) { |
1696 | cFYI(1, ("Existing smb sess not found ")); | 1735 | cFYI(1, ("Existing smb sess not found")); |
1697 | pSesInfo = sesInfoAlloc(); | 1736 | pSesInfo = sesInfoAlloc(); |
1698 | if (pSesInfo == NULL) | 1737 | if (pSesInfo == NULL) |
1699 | rc = -ENOMEM; | 1738 | rc = -ENOMEM; |
@@ -1777,7 +1816,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1777 | find_unc(sin_server.sin_addr.s_addr, volume_info.UNC, | 1816 | find_unc(sin_server.sin_addr.s_addr, volume_info.UNC, |
1778 | volume_info.username); | 1817 | volume_info.username); |
1779 | if (tcon) { | 1818 | if (tcon) { |
1780 | cFYI(1, ("Found match on UNC path ")); | 1819 | cFYI(1, ("Found match on UNC path")); |
1781 | /* we can have only one retry value for a connection | 1820 | /* we can have only one retry value for a connection |
1782 | to a share so for resources mounted more than once | 1821 | to a share so for resources mounted more than once |
1783 | to the same server share the last value passed in | 1822 | to the same server share the last value passed in |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 32cc96cafa3e..fed55e3c53df 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * vfs operations that deal with dentries | 4 | * vfs operations that deal with dentries |
5 | * | 5 | * |
6 | * Copyright (C) International Business Machines Corp., 2002,2003 | 6 | * Copyright (C) International Business Machines Corp., 2002,2005 |
7 | * Author(s): Steve French (sfrench@us.ibm.com) | 7 | * Author(s): Steve French (sfrench@us.ibm.com) |
8 | * | 8 | * |
9 | * This library is free software; you can redistribute it and/or modify | 9 | * This library is free software; you can redistribute it and/or modify |
@@ -200,8 +200,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
200 | (oplock & CIFS_CREATE_ACTION)) | 200 | (oplock & CIFS_CREATE_ACTION)) |
201 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { | 201 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { |
202 | CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, | 202 | CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, |
203 | (__u64)current->euid, | 203 | (__u64)current->fsuid, |
204 | (__u64)current->egid, | 204 | (__u64)current->fsgid, |
205 | 0 /* dev */, | 205 | 0 /* dev */, |
206 | cifs_sb->local_nls, | 206 | cifs_sb->local_nls, |
207 | cifs_sb->mnt_cifs_flags & | 207 | cifs_sb->mnt_cifs_flags & |
@@ -325,7 +325,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, | |||
325 | else if (pTcon->ses->capabilities & CAP_UNIX) { | 325 | else if (pTcon->ses->capabilities & CAP_UNIX) { |
326 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { | 326 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { |
327 | rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, | 327 | rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, |
328 | mode,(__u64)current->euid,(__u64)current->egid, | 328 | mode,(__u64)current->fsuid,(__u64)current->fsgid, |
329 | device_number, cifs_sb->local_nls, | 329 | device_number, cifs_sb->local_nls, |
330 | cifs_sb->mnt_cifs_flags & | 330 | cifs_sb->mnt_cifs_flags & |
331 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 331 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 14a1c72ced92..b67be3d8c019 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -870,7 +870,6 @@ static ssize_t cifs_write(struct file *file, const char *write_data, | |||
870 | if (rc != 0) | 870 | if (rc != 0) |
871 | break; | 871 | break; |
872 | } | 872 | } |
873 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
874 | /* BB FIXME We can not sign across two buffers yet */ | 873 | /* BB FIXME We can not sign across two buffers yet */ |
875 | if((experimEnabled) && ((pTcon->ses->server->secMode & | 874 | if((experimEnabled) && ((pTcon->ses->server->secMode & |
876 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) == 0)) { | 875 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) == 0)) { |
@@ -889,7 +888,6 @@ static ssize_t cifs_write(struct file *file, const char *write_data, | |||
889 | iov, 1, long_op); | 888 | iov, 1, long_op); |
890 | } else | 889 | } else |
891 | /* BB FIXME fixup indentation of line below */ | 890 | /* BB FIXME fixup indentation of line below */ |
892 | #endif | ||
893 | rc = CIFSSMBWrite(xid, pTcon, | 891 | rc = CIFSSMBWrite(xid, pTcon, |
894 | open_file->netfid, | 892 | open_file->netfid, |
895 | min_t(const int, cifs_sb->wsize, | 893 | min_t(const int, cifs_sb->wsize, |
@@ -1026,7 +1024,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) | |||
1026 | return rc; | 1024 | return rc; |
1027 | } | 1025 | } |
1028 | 1026 | ||
1029 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
1030 | static int cifs_writepages(struct address_space *mapping, | 1027 | static int cifs_writepages(struct address_space *mapping, |
1031 | struct writeback_control *wbc) | 1028 | struct writeback_control *wbc) |
1032 | { | 1029 | { |
@@ -1229,7 +1226,6 @@ retry: | |||
1229 | 1226 | ||
1230 | return rc; | 1227 | return rc; |
1231 | } | 1228 | } |
1232 | #endif | ||
1233 | 1229 | ||
1234 | static int cifs_writepage(struct page* page, struct writeback_control *wbc) | 1230 | static int cifs_writepage(struct page* page, struct writeback_control *wbc) |
1235 | { | 1231 | { |
@@ -1875,9 +1871,7 @@ struct address_space_operations cifs_addr_ops = { | |||
1875 | .readpage = cifs_readpage, | 1871 | .readpage = cifs_readpage, |
1876 | .readpages = cifs_readpages, | 1872 | .readpages = cifs_readpages, |
1877 | .writepage = cifs_writepage, | 1873 | .writepage = cifs_writepage, |
1878 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
1879 | .writepages = cifs_writepages, | 1874 | .writepages = cifs_writepages, |
1880 | #endif | ||
1881 | .prepare_write = cifs_prepare_write, | 1875 | .prepare_write = cifs_prepare_write, |
1882 | .commit_write = cifs_commit_write, | 1876 | .commit_write = cifs_commit_write, |
1883 | .set_page_dirty = __set_page_dirty_nobuffers, | 1877 | .set_page_dirty = __set_page_dirty_nobuffers, |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 411c1f7f84da..d1e995757436 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -750,8 +750,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
750 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { | 750 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { |
751 | CIFSSMBUnixSetPerms(xid, pTcon, full_path, | 751 | CIFSSMBUnixSetPerms(xid, pTcon, full_path, |
752 | mode, | 752 | mode, |
753 | (__u64)current->euid, | 753 | (__u64)current->fsuid, |
754 | (__u64)current->egid, | 754 | (__u64)current->fsgid, |
755 | 0 /* dev_t */, | 755 | 0 /* dev_t */, |
756 | cifs_sb->local_nls, | 756 | cifs_sb->local_nls, |
757 | cifs_sb->mnt_cifs_flags & | 757 | cifs_sb->mnt_cifs_flags & |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 94baf6c8ecbd..ac5a72a299a3 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/misc.c | 2 | * fs/cifs/misc.c |
3 | * | 3 | * |
4 | * Copyright (C) International Business Machines Corp., 2002,2004 | 4 | * Copyright (C) International Business Machines Corp., 2002,2005 |
5 | * Author(s): Steve French (sfrench@us.ibm.com) | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
6 | * | 6 | * |
7 | * This library is free software; you can redistribute it and/or modify | 7 | * This library is free software; you can redistribute it and/or modify |
@@ -161,6 +161,9 @@ cifs_buf_get(void) | |||
161 | if (ret_buf) { | 161 | if (ret_buf) { |
162 | memset(ret_buf, 0, sizeof(struct smb_hdr) + 3); | 162 | memset(ret_buf, 0, sizeof(struct smb_hdr) + 3); |
163 | atomic_inc(&bufAllocCount); | 163 | atomic_inc(&bufAllocCount); |
164 | #ifdef CONFIG_CIFS_STATS2 | ||
165 | atomic_inc(&totBufAllocCount); | ||
166 | #endif /* CONFIG_CIFS_STATS2 */ | ||
164 | } | 167 | } |
165 | 168 | ||
166 | return ret_buf; | 169 | return ret_buf; |
@@ -195,6 +198,10 @@ cifs_small_buf_get(void) | |||
195 | /* No need to clear memory here, cleared in header assemble */ | 198 | /* No need to clear memory here, cleared in header assemble */ |
196 | /* memset(ret_buf, 0, sizeof(struct smb_hdr) + 27);*/ | 199 | /* memset(ret_buf, 0, sizeof(struct smb_hdr) + 27);*/ |
197 | atomic_inc(&smBufAllocCount); | 200 | atomic_inc(&smBufAllocCount); |
201 | #ifdef CONFIG_CIFS_STATS2 | ||
202 | atomic_inc(&totSmBufAllocCount); | ||
203 | #endif /* CONFIG_CIFS_STATS2 */ | ||
204 | |||
198 | } | 205 | } |
199 | return ret_buf; | 206 | return ret_buf; |
200 | } | 207 | } |
@@ -348,12 +355,12 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , | |||
348 | /* BB Add support for establishing new tCon and SMB Session */ | 355 | /* BB Add support for establishing new tCon and SMB Session */ |
349 | /* with userid/password pairs found on the smb session */ | 356 | /* with userid/password pairs found on the smb session */ |
350 | /* for other target tcp/ip addresses BB */ | 357 | /* for other target tcp/ip addresses BB */ |
351 | if(current->uid != treeCon->ses->linux_uid) { | 358 | if(current->fsuid != treeCon->ses->linux_uid) { |
352 | cFYI(1,("Multiuser mode and UID did not match tcon uid ")); | 359 | cFYI(1,("Multiuser mode and UID did not match tcon uid")); |
353 | read_lock(&GlobalSMBSeslock); | 360 | read_lock(&GlobalSMBSeslock); |
354 | list_for_each(temp_item, &GlobalSMBSessionList) { | 361 | list_for_each(temp_item, &GlobalSMBSessionList) { |
355 | ses = list_entry(temp_item, struct cifsSesInfo, cifsSessionList); | 362 | ses = list_entry(temp_item, struct cifsSesInfo, cifsSessionList); |
356 | if(ses->linux_uid == current->uid) { | 363 | if(ses->linux_uid == current->fsuid) { |
357 | if(ses->server == treeCon->ses->server) { | 364 | if(ses->server == treeCon->ses->server) { |
358 | cFYI(1,("found matching uid substitute right smb_uid")); | 365 | cFYI(1,("found matching uid substitute right smb_uid")); |
359 | buffer->Uid = ses->Suid; | 366 | buffer->Uid = ses->Suid; |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index f8871196098c..0abfbf4e4a49 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -206,7 +206,6 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer, | |||
206 | return rc; | 206 | return rc; |
207 | } | 207 | } |
208 | 208 | ||
209 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
210 | static int | 209 | static int |
211 | smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec, | 210 | smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec, |
212 | struct sockaddr *sin) | 211 | struct sockaddr *sin) |
@@ -392,8 +391,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
392 | return -ENOMEM; | 391 | return -ENOMEM; |
393 | } | 392 | } |
394 | 393 | ||
395 | /* BB FIXME */ | 394 | rc = cifs_sign_smb2(iov, n_vec, ses->server, &midQ->sequence_number); |
396 | /* rc = cifs_sign_smb2(iov, n_vec, ses->server, &midQ->sequence_number); */ | ||
397 | 395 | ||
398 | midQ->midState = MID_REQUEST_SUBMITTED; | 396 | midQ->midState = MID_REQUEST_SUBMITTED; |
399 | #ifdef CONFIG_CIFS_STATS2 | 397 | #ifdef CONFIG_CIFS_STATS2 |
@@ -492,11 +490,17 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
492 | 490 | ||
493 | if (midQ->resp_buf && | 491 | if (midQ->resp_buf && |
494 | (midQ->midState == MID_RESPONSE_RECEIVED)) { | 492 | (midQ->midState == MID_RESPONSE_RECEIVED)) { |
493 | |||
495 | in_buf->smb_buf_length = receive_len; | 494 | in_buf->smb_buf_length = receive_len; |
496 | /* BB verify that length would not overrun small buf */ | 495 | if(receive_len > 500) { |
497 | memcpy((char *)in_buf + 4, | 496 | /* use multiple buffers on way out */ |
498 | (char *)midQ->resp_buf + 4, | 497 | } else { |
499 | receive_len); | 498 | memcpy((char *)in_buf + 4, |
499 | (char *)midQ->resp_buf + 4, | ||
500 | receive_len); | ||
501 | iov[0].iov_len = receive_len + 4; | ||
502 | iov[1].iov_len = 0; | ||
503 | } | ||
500 | 504 | ||
501 | dump_smb(in_buf, 80); | 505 | dump_smb(in_buf, 80); |
502 | /* convert the length into a more usable form */ | 506 | /* convert the length into a more usable form */ |
@@ -549,7 +553,6 @@ out_unlock2: | |||
549 | 553 | ||
550 | return rc; | 554 | return rc; |
551 | } | 555 | } |
552 | #endif /* CIFS_EXPERIMENTAL */ | ||
553 | 556 | ||
554 | int | 557 | int |
555 | SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | 558 | SendReceive(const unsigned int xid, struct cifsSesInfo *ses, |