aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index cf606910cb68..8f436ef24368 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -158,10 +158,11 @@ cifs_reconnect(struct TCP_Server_Info *server)
158 /* do not want to be sending data on a socket we are freeing */ 158 /* do not want to be sending data on a socket we are freeing */
159 down(&server->tcpSem); 159 down(&server->tcpSem);
160 if(server->ssocket) { 160 if(server->ssocket) {
161 cFYI(1,("State: 0x%x Flags: 0x%lx", server->ssocket->state, 161 cFYI(1, ("State: 0x%x Flags: 0x%lx", server->ssocket->state,
162 server->ssocket->flags)); 162 server->ssocket->flags));
163 server->ssocket->ops->shutdown(server->ssocket,SEND_SHUTDOWN); 163 server->ssocket->ops->shutdown(server->ssocket,SEND_SHUTDOWN);
164 cFYI(1,("Post shutdown state: 0x%x Flags: 0x%lx", server->ssocket->state, 164 cFYI(1, ("Post shutdown state: 0x%x Flags: 0x%lx",
165 server->ssocket->state,
165 server->ssocket->flags)); 166 server->ssocket->flags));
166 sock_release(server->ssocket); 167 sock_release(server->ssocket);
167 server->ssocket = NULL; 168 server->ssocket = NULL;
@@ -197,7 +198,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
197 server->server_RFC1001_name); 198 server->server_RFC1001_name);
198 } 199 }
199 if(rc) { 200 if(rc) {
200 cFYI(1,("reconnect error %d",rc)); 201 cFYI(1, ("reconnect error %d",rc));
201 msleep(3000); 202 msleep(3000);
202 } else { 203 } else {
203 atomic_inc(&tcpSesReconnectCount); 204 atomic_inc(&tcpSesReconnectCount);
@@ -233,7 +234,7 @@ static int check2ndT2(struct smb_hdr * pSMB, unsigned int maxBufSize)
233 /* check for plausible wct, bcc and t2 data and parm sizes */ 234 /* check for plausible wct, bcc and t2 data and parm sizes */
234 /* check for parm and data offset going beyond end of smb */ 235 /* check for parm and data offset going beyond end of smb */
235 if(pSMB->WordCount != 10) { /* coalesce_t2 depends on this */ 236 if(pSMB->WordCount != 10) { /* coalesce_t2 depends on this */
236 cFYI(1,("invalid transact2 word count")); 237 cFYI(1, ("invalid transact2 word count"));
237 return -EINVAL; 238 return -EINVAL;
238 } 239 }
239 240
@@ -247,11 +248,11 @@ static int check2ndT2(struct smb_hdr * pSMB, unsigned int maxBufSize)
247 if(remaining == 0) 248 if(remaining == 0)
248 return 0; 249 return 0;
249 else if(remaining < 0) { 250 else if(remaining < 0) {
250 cFYI(1,("total data %d smaller than data in frame %d", 251 cFYI(1, ("total data %d smaller than data in frame %d",
251 total_data_size, data_in_this_rsp)); 252 total_data_size, data_in_this_rsp));
252 return -EINVAL; 253 return -EINVAL;
253 } else { 254 } else {
254 cFYI(1,("missing %d bytes from transact2, check next response", 255 cFYI(1, ("missing %d bytes from transact2, check next response",
255 remaining)); 256 remaining));
256 if(total_data_size > maxBufSize) { 257 if(total_data_size > maxBufSize) {
257 cERROR(1,("TotalDataSize %d is over maximum buffer %d", 258 cERROR(1,("TotalDataSize %d is over maximum buffer %d",
@@ -292,7 +293,7 @@ static int coalesce_t2(struct smb_hdr * psecond, struct smb_hdr *pTargetSMB)
292 293
293 total_in_buf2 = le16_to_cpu(pSMB2->t2_rsp.DataCount); 294 total_in_buf2 = le16_to_cpu(pSMB2->t2_rsp.DataCount);
294 if(remaining < total_in_buf2) { 295 if(remaining < total_in_buf2) {
295 cFYI(1,("transact2 2nd response contains too much data")); 296 cFYI(1, ("transact2 2nd response contains too much data"));
296 } 297 }
297 298
298 /* find end of first SMB data area */ 299 /* find end of first SMB data area */
@@ -321,7 +322,7 @@ static int coalesce_t2(struct smb_hdr * psecond, struct smb_hdr *pTargetSMB)
321 pTargetSMB->smb_buf_length = byte_count; 322 pTargetSMB->smb_buf_length = byte_count;
322 323
323 if(remaining == total_in_buf2) { 324 if(remaining == total_in_buf2) {
324 cFYI(1,("found the last secondary response")); 325 cFYI(1, ("found the last secondary response"));
325 return 0; /* we are done */ 326 return 0; /* we are done */
326 } else /* more responses to go */ 327 } else /* more responses to go */
327 return 1; 328 return 1;
@@ -424,10 +425,10 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
424 break; 425 break;
425 } 426 }
426 if (!try_to_freeze() && (length == -EINTR)) { 427 if (!try_to_freeze() && (length == -EINTR)) {
427 cFYI(1,("cifsd thread killed")); 428 cFYI(1, ("cifsd thread killed"));
428 break; 429 break;
429 } 430 }
430 cFYI(1,("Reconnect after unexpected peek error %d", 431 cFYI(1, ("Reconnect after unexpected peek error %d",
431 length)); 432 length));
432 cifs_reconnect(server); 433 cifs_reconnect(server);
433 csocket = server->ssocket; 434 csocket = server->ssocket;
@@ -457,12 +458,12 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
457 pdu_length = ntohl(smb_buffer->smb_buf_length); 458 pdu_length = ntohl(smb_buffer->smb_buf_length);
458 smb_buffer->smb_buf_length = pdu_length; 459 smb_buffer->smb_buf_length = pdu_length;
459 460
460 cFYI(1,("rfc1002 length 0x%x)", pdu_length+4)); 461 cFYI(1, ("rfc1002 length 0x%x", pdu_length+4));
461 462
462 if (temp == (char) RFC1002_SESSION_KEEP_ALIVE) { 463 if (temp == (char) RFC1002_SESSION_KEEP_ALIVE) {
463 continue; 464 continue;
464 } else if (temp == (char)RFC1002_POSITIVE_SESSION_RESPONSE) { 465 } else if (temp == (char)RFC1002_POSITIVE_SESSION_RESPONSE) {
465 cFYI(1,("Good RFC 1002 session rsp")); 466 cFYI(1, ("Good RFC 1002 session rsp"));
466 continue; 467 continue;
467 } else if (temp == (char)RFC1002_NEGATIVE_SESSION_RESPONSE) { 468 } else if (temp == (char)RFC1002_NEGATIVE_SESSION_RESPONSE) {
468 /* we get this from Windows 98 instead of 469 /* we get this from Windows 98 instead of
@@ -808,7 +809,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
808 separator[0] = options[4]; 809 separator[0] = options[4];
809 options += 5; 810 options += 5;
810 } else { 811 } else {
811 cFYI(1,("Null separator not allowed")); 812 cFYI(1, ("Null separator not allowed"));
812 } 813 }
813 } 814 }
814 815
@@ -1020,7 +1021,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
1020 strcpy(vol->prepath+1,value); 1021 strcpy(vol->prepath+1,value);
1021 } else 1022 } else
1022 strcpy(vol->prepath,value); 1023 strcpy(vol->prepath,value);
1023 cFYI(1,("prefix path %s",vol->prepath)); 1024 cFYI(1, ("prefix path %s",vol->prepath));
1024 } else { 1025 } else {
1025 printk(KERN_WARNING "CIFS: prefix too long\n"); 1026 printk(KERN_WARNING "CIFS: prefix too long\n");
1026 return 1; 1027 return 1;
@@ -1110,7 +1111,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
1110 } else if (strnicmp(data, "servern", 7) == 0) { 1111 } else if (strnicmp(data, "servern", 7) == 0) {
1111 /* servernetbiosname specified override *SMBSERVER */ 1112 /* servernetbiosname specified override *SMBSERVER */
1112 if (!value || !*value || (*value == ' ')) { 1113 if (!value || !*value || (*value == ' ')) {
1113 cFYI(1,("empty server netbiosname specified")); 1114 cFYI(1, ("empty server netbiosname specified"));
1114 } else { 1115 } else {
1115 /* last byte, type, is 0x20 for servr type */ 1116 /* last byte, type, is 0x20 for servr type */
1116 memset(vol->target_rfc1001_name,0x20,16); 1117 memset(vol->target_rfc1001_name,0x20,16);
@@ -1430,7 +1431,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
1430 return rc; 1431 return rc;
1431 } else { 1432 } else {
1432 /* BB other socket options to set KEEPALIVE, NODELAY? */ 1433 /* BB other socket options to set KEEPALIVE, NODELAY? */
1433 cFYI(1,("Socket created")); 1434 cFYI(1, ("Socket created"));
1434 (*csocket)->sk->sk_allocation = GFP_NOFS; 1435 (*csocket)->sk->sk_allocation = GFP_NOFS;
1435 } 1436 }
1436 } 1437 }
@@ -1739,7 +1740,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1739 volume_info.username = NULL; 1740 volume_info.username = NULL;
1740 } else if (volume_info.username) { 1741 } else if (volume_info.username) {
1741 /* BB fixme parse for domain name here */ 1742 /* BB fixme parse for domain name here */
1742 cFYI(1, ("Username: %s ", volume_info.username)); 1743 cFYI(1, ("Username: %s", volume_info.username));
1743 } else { 1744 } else {
1744 cifserror("No username specified"); 1745 cifserror("No username specified");
1745 /* In userspace mount helper we can get user name from alternate 1746 /* In userspace mount helper we can get user name from alternate
@@ -1974,7 +1975,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1974 if (cifs_sb->rsize < 2048) { 1975 if (cifs_sb->rsize < 2048) {
1975 cifs_sb->rsize = 2048; 1976 cifs_sb->rsize = 2048;
1976 /* Windows ME may prefer this */ 1977 /* Windows ME may prefer this */
1977 cFYI(1,("readsize set to minimum: 2048")); 1978 cFYI(1, ("readsize set to minimum: 2048"));
1978 } 1979 }
1979 /* calculate prepath */ 1980 /* calculate prepath */
1980 cifs_sb->prepath = volume_info.prepath; 1981 cifs_sb->prepath = volume_info.prepath;
@@ -1988,8 +1989,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1988 cifs_sb->mnt_gid = volume_info.linux_gid; 1989 cifs_sb->mnt_gid = volume_info.linux_gid;
1989 cifs_sb->mnt_file_mode = volume_info.file_mode; 1990 cifs_sb->mnt_file_mode = volume_info.file_mode;
1990 cifs_sb->mnt_dir_mode = volume_info.dir_mode; 1991 cifs_sb->mnt_dir_mode = volume_info.dir_mode;
1991 cFYI(1,("file mode: 0x%x dir mode: 0x%x", 1992 cFYI(1, ("file mode: 0x%x dir mode: 0x%x",
1992 cifs_sb->mnt_file_mode,cifs_sb->mnt_dir_mode)); 1993 cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode));
1993 1994
1994 if (volume_info.noperm) 1995 if (volume_info.noperm)
1995 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; 1996 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM;
@@ -2012,7 +2013,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2012 if (volume_info.override_gid) 2013 if (volume_info.override_gid)
2013 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID; 2014 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID;
2014 if (volume_info.direct_io) { 2015 if (volume_info.direct_io) {
2015 cFYI(1,("mounting share using direct i/o")); 2016 cFYI(1, ("mounting share using direct i/o"));
2016 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO; 2017 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO;
2017 } 2018 }
2018 2019
@@ -2135,7 +2136,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2135 else if(cifs_sb->rsize > (1024 * 127)) { 2136 else if(cifs_sb->rsize > (1024 * 127)) {
2136 cifs_sb->rsize = 1024 * 127; 2137 cifs_sb->rsize = 1024 * 127;
2137#ifdef CONFIG_CIFS_DEBUG2 2138#ifdef CONFIG_CIFS_DEBUG2
2138 cFYI(1,("no very large read support, rsize 127K")); 2139 cFYI(1, ("no very large read support, rsize 127K"));
2139#endif 2140#endif
2140 2141
2141 } 2142 }
@@ -2354,7 +2355,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2354 ses->serverNOS[1 + (2 * len)] = 0; 2355 ses->serverNOS[1 + (2 * len)] = 0;
2355 if(strncmp(ses->serverNOS, 2356 if(strncmp(ses->serverNOS,
2356 "NT LAN Manager 4",16) == 0) { 2357 "NT LAN Manager 4",16) == 0) {
2357 cFYI(1,("NT4 server")); 2358 cFYI(1, ("NT4 server"));
2358 ses->flags |= CIFS_SES_NT4; 2359 ses->flags |= CIFS_SES_NT4;
2359 } 2360 }
2360 remaining_words -= len + 1; 2361 remaining_words -= len + 1;
@@ -3365,7 +3366,7 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb)
3365 FreeXid(xid); 3366 FreeXid(xid);
3366 return 0; 3367 return 0;
3367 } else if (rc == -ESHUTDOWN) { 3368 } else if (rc == -ESHUTDOWN) {
3368 cFYI(1,("Waking up socket by sending signal")); 3369 cFYI(1, ("Waking up socket by sending signal"));
3369 if (cifsd_task) { 3370 if (cifsd_task) {
3370 force_sig(SIGKILL,cifsd_task); 3371 force_sig(SIGKILL,cifsd_task);
3371 kthread_stop(cifsd_task); 3372 kthread_stop(cifsd_task);
@@ -3447,7 +3448,7 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
3447 if (!rc) { 3448 if (!rc) {
3448 if(ntlmv2_flag) { 3449 if(ntlmv2_flag) {
3449 char * v2_response; 3450 char * v2_response;
3450 cFYI(1,("more secure NTLM ver2 hash")); 3451 cFYI(1, ("more secure NTLM ver2 hash"));
3451 if(CalcNTLMv2_partial_mac_key(pSesInfo, 3452 if(CalcNTLMv2_partial_mac_key(pSesInfo,
3452 nls_info)) { 3453 nls_info)) {
3453 rc = -ENOMEM; 3454 rc = -ENOMEM;
@@ -3503,7 +3504,7 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
3503 if (rc) { 3504 if (rc) {
3504 cERROR(1,("Send error in SessSetup = %d",rc)); 3505 cERROR(1,("Send error in SessSetup = %d",rc));
3505 } else { 3506 } else {
3506 cFYI(1,("CIFS Session Established successfully")); 3507 cFYI(1, ("CIFS Session Established successfully"));
3507 pSesInfo->status = CifsGood; 3508 pSesInfo->status = CifsGood;
3508 } 3509 }
3509 } 3510 }